BuyProAdd.ts 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. // Learn TypeScript:
  2. // - https://docs.cocos.com/creator/manual/en/scripting/typescript.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. import PoolMgr, { NODEPOOLPREFABTYPE } from "../manager/PoolMgr";
  8. const { ccclass, property } = cc._decorator;
  9. @ccclass
  10. export default class BuyProAdd extends cc.Component {
  11. @property(cc.Label)
  12. lab: cc.Label = null;
  13. @property(cc.Animation)
  14. ani: cc.Animation = null;
  15. // onLoad () {}
  16. start() {
  17. }
  18. init(str: string) {
  19. this.ani.play('upFadePro', 0)
  20. this.ani.on(cc.Animation.EventType.FINISHED, this.onFinish, this)
  21. this.lab.string = str
  22. }
  23. onFinish() {
  24. //FC:-
  25. //this.node.destroy()
  26. this.ani.off(cc.Animation.EventType.FINISHED, this.onFinish, this)
  27. //FC:+ 对象池
  28. PoolMgr.Inst.recyclePoolPrefab(NODEPOOLPREFABTYPE.BuyProAdd, this.node);
  29. }
  30. // update (dt) {}
  31. }