123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- var Global = require("Global");
- var GameProtocol = require("RaioGameProtocol");
- cc.Class({
- extends: cc.Component,
- editor: {
- menu: 'Game/Raio/Item'
- },
- properties: {
- normalBG: cc.Node,
- normalAni: sp.Skeleton,
- aniNode: cc.Node,
- _value: -1,
- _lineCount: 0,
- _bSpecial: false,
- },
- setValue (_val, spineData, _bSpe) {
- this._value = _val;
- this._bSpecial = _bSpe;
- this.normalAni.skeletonData = spineData;
- this._bNewOppr = false;
- this.node.scale = 1;
- if(this._bSpecial) {
- this.node.scale = 1.1;
- }
- this.showRolling();
- },
- getValue() {
- return this._value;
- },
- resetCount() {
- this._lineCount = 0;
- this.showNormal();
- },
- addCount() {
- this._lineCount++;
- },
- setCount(_val) {
- this._lineCount = _val;
- },
- getCount() {
- return this._lineCount;
- },
- showRolling() {
- this.normalBG.stopAllActions();
- this.aniNode.active = false;
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, 'a0', false);
- },
- showNormal() {
- if(this._bSpecial) {return;}
- this.normalBG.stopAllActions();
- this.aniNode.active = false;
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, 'a1', true);
- },
- resetShow() {
- this.node.opacity = 255;
- // this.showNormal();
- },
- resetCashShow() {
- if(!this._bSpecial) {
- this.showNormal();
- return;
- }
- this._bNewOppr = false;
- this.aniNode.active = false;
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a1", true);
- },
- //cash中级动画
- showLightAni(bPrizes) {
- if(!this._bSpecial) {
- this.showNormal();
- return;
- }
- this._bNewOppr = true;
- this.aniNode.active = false;
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a2", false);
- // if(!bPrizes)
- // this.normalAni.addAnimation(0, "a0", true);
- },
- showNewPrizes(bPrizes) {
- if(!this._bSpecial) {return;}
- if(this._bNewOppr) {
- Global.print("showNewPrizes")
- this._bNewOppr = false;
- this.aniNode.active = false;
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- if(bPrizes) {
- this.normalAni.setAnimation(0, "a3", false);
- this.normalAni.addAnimation(0, "a1", true);
- }else{
- this.normalAni.setAnimation(0, "a1", true);
- }
- // this.normalAni.setAnimation(0, "a3", false);
- // this.normalAni.addAnimation(0, "a1", true);
- }
- },
- showEndPrizes() {
- if(!this._bSpecial) {return;}
- this.aniNode.active = true;
- let ani = this.aniNode.getComponent(sp.Skeleton);
- ani.clearTracks();
- ani.setAnimation(0, 'a3', false);
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a3", false);
- this.normalAni.addAnimation(0, "a4", true);
- },
- goCashPrizes(bShow) {
- if(bShow) {
- this.node.opacity = 255;
- }else{
- this.node.opacity = 85;
- }
- },
- showNotPrizes() {
- this.node.opacity = 85;
- if(this._bSpecial) {
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a4", false);
- }
- },
- showPrizes() {
- if(this._lineCount <= 0) {
- this.showNotPrizes();
- return;
- }
- this.node.opacity = 255;
- this.aniNode.active = false;
- this.normalBG.stopAllActions();
- this.normalAni.clearTracks();
- this.normalAni.setAnimation(0, "a2", false);
- this.normalAni.addAnimation(0, "a1", true);
- },
- playEffect(effName, needStop = false) {
- if(needStop)
- cc.vv.audioMgr.stopAllEffects();
- cc.vv.audioMgr.playSFX(effName);
- },
- // update (dt) {},
- });
|