// Learn TypeScript: // - https://docs.cocos.com/creator/manual/en/scripting/typescript.html // Learn Attribute: // - https://docs.cocos.com/creator/manual/en/scripting/reference/attributes.html // Learn life-cycle callbacks: // - https://docs.cocos.com/creator/manual/en/scripting/life-cycle-callbacks.html import PoolMgr, { NODEPOOLPREFABTYPE } from "../manager/PoolMgr"; import Sciencen_M from "../utils/Sciencen_M"; const { ccclass, property } = cc._decorator; @ccclass export default class CarAddGold extends cc.Component { @property(cc.Label) lab: cc.Label = null; @property(cc.Animation) ani: cc.Animation = null; // onLoad () {} start() { } init(gold: string) { this.ani.play('upFade', 0) this.ani.on(cc.Animation.EventType.FINISHED, this.onFinish, this) this.lab.string = '+' + Sciencen_M.instance.format(gold) } onFinish() { //FC:- //this.node.destroy() this.ani.off(cc.Animation.EventType.FINISHED, this.onFinish, this) //FC:+ 对象池 PoolMgr.Inst.recyclePoolPrefab(NODEPOOLPREFABTYPE.CarAddGold, this.node); } // update (dt) {} }