1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192 |
- var Global = require("Global");
- var GameProtocol = require("SGLBGameProtocol");
- cc.Class({
- extends: cc.Component,
- editor: {
- menu: 'Game/SGLB/Item'
- },
- properties: {
- normalBG: cc.Node,
- normalAni: sp.Skeleton,
- aniNode: cc.Node,
- _value: -1,
- _lineCount: 0,
- _bFree: false,
- },
- // LIFE-CYCLE CALLBACKS:
- // onLoad () {},
- setValue (_val, spineData) {
- this._value = _val;
- this._bFree = (_val == GameProtocol.FREE_ICON);
- this.normalAni.skeletonData = spineData;
- this.showNormal();
- },
- resetCount() {
- this._lineCount = 0;
- this.showNormal();
- },
- addCount() {
- this._lineCount++;
- },
- showNormal() {
- this.normalBG.stopAllActions();
- this.normalBG.scale = 1;
- this.aniNode.active = false;
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a1", false);
- },
- showSpecial() {
- },
- showLightAni() {
- if(this._lineCount <= 0) {
- this.showNormal();
- return;
- }
- this.aniNode.active = true;
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a2", false);
- // cc.tween(this.normalBG)
- // .sequence(
- // cc.tween().to(0.25, {scale: 1.1}),
- // cc.tween().to(0.25, {scale: 1.0})
- // )
- // .repeatForever()
- // .start()
- },
- showLightAniNoScale() {
- if(this._lineCount <= 0) {
- this.showNormal();
- return;
- }
- this.aniNode.active = true;
- this.normalBG.stopAllActions();
- },
- showSpecialAni() {
- if(!this._bFree) {
- // this.showNormal();
- return;
- }
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a2", false);
- // cc.tween(this.normalBG)
- // .sequence(
- // cc.tween().to(0.25, {scale: 1.1}),
- // cc.tween().to(0.25, {scale: 1.0})
- // )
- // .repeatForever()
- // .start()
- },
- // update (dt) {},
- });
|