cc.Class({ extends: cc.BaseClass, properties: { m_RoomNumber: cc.Label, m_GameRound: cc.Label, m_Show: cc.Node, m_BtViewdesktop: cc.Node, m_BtChangeTable: cc.Node, m_BtContinu: cc.Node, m_BtExit: cc.Node, // m_Bao:cc.Node, // m_Hui:cc.Node, m_WinTitle: cc.Node, m_LoseTitle: cc.Node, m_DrawTitle: cc.Node, // m_BirdCard:[cc.Node],S }, // use this for initialization start: function () { this.m_BtViewdesktop.on(cc.Node.EventType.TOUCH_START, (e) => { this.m_Show.active = false; }); this.m_BtViewdesktop.on(cc.Node.EventType.TOUCH_END, (e) => { this.m_Show.active = true; }); this.updateBtUI() }, ctor: function () { }, ResetData: function () { this.m_WeaveCard = new Array(); }, onLoad: function () { }, updateBtUI() { if (GameDef.m_dwGameRuleArr[3] > 0) { this.m_BtChangeTable.active = true; this.m_BtExit.active = true; this.m_BtContinu.setPosition(200, -296); } else { this.m_BtChangeTable.active = false; this.m_BtExit.active = false; this.m_BtContinu.setPosition(0, -296); } }, onClickBack: function () { cc.gSoundRes.PlaySound("Button"); this.m_Hook.checkTotalEnd(true); this.HideView(); }, onClickContinue: function () { cc.gSoundRes.PlaySound("Button"); this.m_Hook.checkTotalEnd(true); this.HideView(); }, onClickChangeTable: function () { this.HideView(); this.m_Hook.OnBtChangeTable(); }, onClickExit: function () { this.HideView(); this.m_Hook.OnBtReturn(); }, OnClickShare: function () { cc.gSoundRes.PlaySound('Button'); if (cc.sys.isNative) { this.OnShareGameEnd(ThirdPartyShareImg); } else { this.ShowTips("H5遊戲無法分享!"); } }, OnShareGameEnd: function (callback) { var ShareTex = cc.RenderTexture.create(window.SCENE_WIGHT, window.SCENE_HEIGHT); this.node.setPosition(window.SCENE_WIGHT / 2, window.SCENE_HEIGHT / 2) ShareTex.setVisible(false); ShareTex.begin(); this.node._sgNode.visit(); ShareTex.end(); this.node.setPosition(0, 0); this.node.active = false; var filename = "screenShot" + (new Date().getTime()) + ".PNG" ShareTex.saveToFile(filename, cc.ImageFormat.PNG, true, function () { this.node.active = true; ThirdPartyShareImg(jsb.fileUtils.getWritablePath() + filename); }.bind(this)); }, OnShowView: function () { this.m_Hook.m_GameClientView.m_CardView.ChangeCardBack(this.node, this.m_Hook.m_CardBack); this.m_RoomNumber.string = "" + this.m_Hook.m_GameClientView.m_LbTableID.string; this.m_GameRound.string = "" + this.m_Hook.m_GameClientView.m_LbGameProgress.string; var pGameEnd = this.m_Hook.m_GameEnd; if (this.m_ListCtrl == null) this.m_ListCtrl = this.node.getComponent('CustomListCtrl'); this.m_ListCtrl.InitList(0, 'LittleResultItem_' + GameDef.KIND_ID); var wMeChairID = this.m_Hook.MyChairID; console.log("输赢背景", pGameEnd, wMeChairID); let aniNode = null; let aniName = ""; if (pGameEnd.lGangScore[wMeChairID] > 0) { console.log(pGameEnd.lGangScore[wMeChairID], "win", wMeChairID) this.m_WinTitle.active = true; aniNode = this.m_WinTitle.getChildByName("ani"); aniName = "shengli"; this.m_LoseTitle.active = false; this.m_DrawTitle.active = false; } else if (pGameEnd.lGangScore[wMeChairID] < 0) { console.log(pGameEnd.lGangScore[wMeChairID], "lose", wMeChairID) this.m_WinTitle.active = false; this.m_LoseTitle.active = true; aniNode = this.m_LoseTitle.getChildByName("ani"); aniName = "shibai"; this.m_DrawTitle.active = false; } else { console.log(pGameEnd.lGangScore[wMeChairID], "draw", wMeChairID) this.m_WinTitle.active = false; this.m_LoseTitle.active = false; this.m_DrawTitle.active = true; aniNode = this.m_DrawTitle.getChildByName("ani"); aniName = "jiesuan"; } if (aniNode) { aniNode.getComponent("SpineAnimationCtrl")?.playAnimation(`${aniName}_in`, false, false, `${aniName}_loop`, true); let topAniNode = aniNode.parent.getChildByName("aniTop"); if (topAniNode) { cc.tween(topAniNode) .set({ opacity: 0 }) .to(10 / 60, { opacity: 255 }) .start(); } } for (var i = 0; i < GameDef.GAME_PLAYER; i++) { if (pGameEnd.dwUserID[i] == 0) continue; this.m_ListCtrl.InsertListInfo(0, [i, pGameEnd, this.m_Hook.m_wBankerUser == i, this.m_Hook.m_dwRulesArr[0]]); } this.updateBtUI() }, SetTrustee(bTrustee) { if (bTrustee == true) { var sequence = cc.sequence( cc.delayTime(3), cc.callFunc(function () { this.m_Hook.checkTotalEnd(true); this.HideView(); }, this )); this.node.runAction(sequence); } } });