cc.Class({ extends: cc.Component, properties: { m_action: cc.Node, m_Niu: cc.Node, m_Ting: cc.Node, m_win: cc.Node, m_lose: cc.Node, }, ctor: function() { this.m_bIsInit = false; this.m_actionAni = null; this.m_NiuDisplay = null; this.m_TingDisplay = null; this.m_winAni = null; this.m_loseAni = null; }, onLoad: function () { this.Init(); }, Init:function() { if (this.m_bIsInit == true) { return; } this.m_bIsInit = true; if (this.m_actionAni == null) { this.m_actionAni = this.m_action.getComponent('SpineAnimationCtrl'); } if (this.m_NiuDisplay == null) { this.m_NiuDisplay = this.m_Niu.getComponent('AniPrefab'); this.m_NiuDisplay.Init(this); } if (this.m_TingDisplay == null) { this.m_TingDisplay = this.m_Ting.getComponent('AniPrefab'); this.m_TingDisplay.Init(this); } if (this.m_winAni == null) { this.m_winAni = this.m_win.getComponent('SpineAnimationCtrl'); } if (this.m_loseAni == null) { this.m_loseAni = this.m_lose.getComponent('SpineAnimationCtrl'); } }, SetAction:function(wAction,zimo) { this.node.active = true; if(this.m_actionAni == null) { this.Init(); } let showIndex = 0 if (wAction & (GameDef.WIK_GANG_FENG | GameDef.WIK_DNJ | GameDef.WIK_CAI_ZFB | GameDef.WIK_ADD_ZFB | GameDef.WIK_ADD_DNJ | GameDef.WIK_ADD_FENG)) { showIndex = 1; } else if (wAction & GameDef.WIK_LISTEN) { showIndex = 2; } let isClose = 0 == (INVALID_CHAIR | wAction); this.m_action.active = isClose; this.m_Niu.active = 1 == showIndex; this.m_Ting.active = 2 == showIndex; this.m_win.active = isClose; this.m_lose.active = isClose; if (wAction & GameDef.WIK_GANG) { this.m_actionAni.playAnimation('gang', false); } else if (wAction & (GameDef.WIK_LEFT | GameDef.WIK_CENTER | GameDef.WIK_RIGHT)) { this.m_actionAni.playAnimation('chi', false); } else if (wAction & GameDef.WIK_PENG) { this.m_actionAni.playAnimation('peng', false); } else if (wAction & GameDef.WIK_FANG_PAO) { if (zimo & GameDef.CHR_ZI_MO) { this.m_loseAni.playAnimation(); } else { this.m_actionAni.playAnimation('fangpao', false); } } else if (wAction & GameDef.WIK_CHI_HU) { if (zimo & GameDef.CHR_ZI_MO) { this.m_winAni.playAnimation('zimo', false); } else { this.m_winAni.playAnimation('hu', false); } } else if (wAction & (GameDef.WIK_GANG_FENG | GameDef.WIK_DNJ| GameDef.WIK_CAI_ZFB | GameDef.WIK_ADD_ZFB | GameDef.WIK_ADD_DNJ | GameDef.WIK_ADD_FENG)) { this.m_NiuDisplay.PlayAni('Armature', 1); } else if (wAction & GameDef.WIK_LISTEN) { this.m_TingDisplay.PlayAni('Armature', 1); } }, AniFinish:function() { this.node.active = false; }, });