const GameNotificationKey = require('./utils/GameEnum').GameNotificationKey; cc.Class({ extends: cc.Component, properties: { updateCoinSkeletion: sp.Skeleton, }, // LIFE-CYCLE CALLBACKS: onLoad () { this.updateCoinSkeletion.node.active = false; this.updateCoinSkeletion.paused = true; this.updateCoinSkeletion.setCompleteListener(() => { this.updateCoinSkeletion.node.active = false; this.updateCoinSkeletion.paused = true; }); GameEvent.on(GameNotificationKey.PlayUpdateCoinAnimation, this, (position) => { let canvas = cc.find('Canvas'); let canvasPosition = canvas.convertToNodeSpaceAR(position); this.updateCoinSkeletion.node.position = canvasPosition; this.updateCoinSkeletion.paused = false; this.updateCoinSkeletion.node.active = true; this.updateCoinSkeletion.setAnimation(0, 'changjing_kz'); }); }, onDestroy() { GameEvent.off(GameNotificationKey.PlayUpdateCoinAnimation, this); }, start () { }, // update (dt) {}, });