12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364 |
- const GameNotificationKey = require('./utils/GameEnum').GameNotificationKey;
- cc.Class({
- extends: cc.Component,
- properties: {
-
- zIndex: {
-
- default: 0,
-
- notify(oldValue) {
- //减少无效赋值
- if (oldValue === this.zIndex) {
- return;
- }
- this.node.zIndex = this.zIndex;
- }
- },
- },
- // LIFE-CYCLE CALLBACKS:
- onLoad () {
- this.node.zIndex = this.zIndex;
- this._playing = false;
- this.colorBarSkeletion = this.node.getComponent(sp.Skeleton);
- this.colorBarSkeletion.node.active = false;
- this.colorBarSkeletion.paused = true;
- this.colorBarSkeletion.setCompleteListener(() => {
- this.colorBarSkeletion.node.active = false;
- this.colorBarSkeletion.paused = true;
- this._playing = false;
- });
- GameEvent.on(GameNotificationKey.PlaySuccessAnimation, this, () => {
- if (this._playing) { return; }
- this.colorBarSkeletion.node.active = true;
- this.colorBarSkeletion.paused = false;
- this._playing = true;
- let animKeyArray = ['caidai1', 'caidai2'];
- let random = Math.floor(Math.random() * 2);
- this.colorBarSkeletion.setAnimation(0, animKeyArray[random], false);
-
- });
- },
- onDestroy() {
- GameEvent.off(GameNotificationKey.PlaySuccessAnimation, this)
- },
- start () {
- },
- // update (dt) {},
- });
|