| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153 |
- cc.Class({
- extends: cc.BaseClass,
- properties: {
- m_RoomNumber:cc.Label,
- m_GameRound:cc.Label,
- m_Show:cc.Node,
- m_BtViewdesktop: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;
- });
- },
- ctor:function(){
- },
- ResetData:function(){
- this.m_WeaveCard = new Array();
- },
- onLoad: function () {
- },
- 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();
- },
- onClickViewdesktop:function(){
-
-
- },
- 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]]);
- }
- },
- 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);
- }
- }
- });
|