chunk_controller.js 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. // Learn cc.Class:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/class.html
  3. // Learn Attribute:
  4. // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html
  5. // Learn life-cycle callbacks:
  6. // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html
  7. cc.Class({
  8. extends: cc.Component,
  9. properties: {
  10. icon1:{
  11. default:null,
  12. type:cc.SpriteFrame
  13. },
  14. icon2:{
  15. default:null,
  16. type:cc.SpriteFrame
  17. },
  18. icon3:{
  19. default:null,
  20. type:cc.SpriteFrame
  21. },
  22. icon4:{
  23. default:null,
  24. type:cc.SpriteFrame
  25. },
  26. icon5:{
  27. default:null,
  28. type:cc.SpriteFrame
  29. },
  30. icon6:{
  31. default:null,
  32. type:cc.SpriteFrame
  33. }
  34. },
  35. flush:function(){
  36. this._sprite.spriteFrame = this["icon"+this.node.type]
  37. },
  38. explode:function(){
  39. this.node.enable = false ;
  40. this._animation.play("explosion"+this.node.type)
  41. },
  42. callback:function(func, target){
  43. this._animation.once("finished", func, target)
  44. },
  45. onLoad:function(){
  46. this._sprite = this.node.getComponent(cc.Sprite)
  47. this._animation = this.node.getComponent(cc.Animation)
  48. }
  49. });