浏览代码

【bug】修改红包提现页面重复添加监听问题

mojunshou 7 月之前
父节点
当前提交
1190d9b13b

文件差异内容过多而无法显示
+ 310 - 233
assets/bundle/gui/eliminate/prefab/redPacketWithdrawal.prefab


+ 2 - 1
assets/resources/config.json

@@ -17,7 +17,8 @@
         "gameVersion": "当前版本 1.0.0",
         "gameVersion": "当前版本 1.0.0",
         "gameCompanyName": "广州市游戏科技有限公司",
         "gameCompanyName": "广州市游戏科技有限公司",
         "gamePrivacyUrl": "https://doc.v8dashen.com/doc/fc3ae42ddf3b5734",
         "gamePrivacyUrl": "https://doc.v8dashen.com/doc/fc3ae42ddf3b5734",
-        "gameProtocolUrl": "https://doc.v8dashen.com/doc/f692eedce36f7fb1"
+        "gameProtocolUrl": "https://doc.v8dashen.com/doc/f692eedce36f7fb1",
+        "isRelease": false
     },
     },
     "gui": [
     "gui": [
         {
         {

+ 2 - 0
assets/script/game/common/manager/ProtocolEvent.ts

@@ -9,6 +9,8 @@
 // const server_url = "http://192.168.10.103:8880";
 // const server_url = "http://192.168.10.103:8880";
 // https://central-test.atmob.com
 // https://central-test.atmob.com
 const server_url = "https://central-test.atmob.com";
 const server_url = "https://central-test.atmob.com";
+
+
 export enum ProtocolEvent {
 export enum ProtocolEvent {
     /**微信登录*/
     /**微信登录*/
     WechatLogin = server_url + "/project/playlet/v1/user/login",
     WechatLogin = server_url + "/project/playlet/v1/user/login",

+ 24 - 1
assets/script/game/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-28 11:46:45
+ * @LastEditTime: 2025-04-28 14:43:41
  * @Description: 消除游戏主场景
  * @Description: 消除游戏主场景
  */
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -2388,6 +2388,29 @@ export class EliminateViewComp extends CCComp {
         }
         }
     }
     }
 
 
+
+    protected onDestroy(): void {
+        oops.message.off(GameEvent.RestartGame, this.restartGame, this);
+        oops.message.off(GameEvent.DoubleSpeedOpenSuccess, this.doubleSpeedOpenSuccess, this);
+        oops.message.off(GameEvent.openView, this.openView, this);
+        oops.message.off(GameEvent.showCoinAnimation, this.showCoinAnimation, this);
+        oops.message.off(GameEvent.updateHbAndWxCoin, this.updateCoin, this);
+        oops.message.off(GameEvent.StartAutoGame, this.startAutoGame, this);
+        oops.message.off(GameEvent.updateGameState, this.updateGameState, this);
+        oops.message.off(GameEvent.updateGameScore, this.updateGameScore, this);
+        oops.message.off(GameEvent.pauseGame, this.pauseGame, this);
+        oops.message.off(GameEvent.resumeGame, this.resumeGame, this);
+    }
+
+
+
+
+
+
+
+
+
+
     btn_text() {
     btn_text() {
         const param = {
         const param = {
             "code": 0,
             "code": 0,

+ 20 - 20
assets/script/game/view/RedPackeWithdrawalViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 17:53:50
  * @Date: 2025-03-20 17:53:50
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-28 11:29:05
+ * @LastEditTime: 2025-04-28 14:50:50
  * @Description: 红包提现
  * @Description: 红包提现
  */
  */
 import { _decorator, Label, Node } from "cc";
 import { _decorator, Label, Node } from "cc";
@@ -40,7 +40,9 @@ export class RedPackeWithdrawalViewComp extends CCVMParentComp {
 
 
     data: any = {
     data: any = {
         tasklist: [],
         tasklist: [],
-        goldNum: 0
+        goldNum: 0,
+        wxCash: 0,
+        hbCoin: 0
     };
     };
     start() {
     start() {
         this.setButton();
         this.setButton();
@@ -49,14 +51,13 @@ export class RedPackeWithdrawalViewComp extends CCVMParentComp {
         this.data.taskList = smc.game.GameModel.taskList;
         this.data.taskList = smc.game.GameModel.taskList;
         let wxCash = smc.game.GameModel.wxCash;
         let wxCash = smc.game.GameModel.wxCash;
         let hbCoin = Format.formatRedPacketCoin(smc.account.AccountModel.hbCoin);
         let hbCoin = Format.formatRedPacketCoin(smc.account.AccountModel.hbCoin);
-        this.lab_wxCash.string = `${wxCash}`;
-        this.lab_hbCoin.string = `${hbCoin}`;
+        this.data.wxCash = wxCash;
+        this.data.hbCoin = hbCoin;
         this.data.goldNum = smc.account.AccountModel.goldCoin;
         this.data.goldNum = smc.account.AccountModel.goldCoin;
         if (this.data.taskList.length > 0) {
         if (this.data.taskList.length > 0) {
             this.recordList.numItems = this.data.taskList.length;
             this.recordList.numItems = this.data.taskList.length;
         }
         }
-        this.lab_tips.string = `当前收集金砖${this.data.goldNum}块,红包10000元=人民币1元`;
-
+        // this.lab_tips.string = `当前收集金砖${this.data.goldNum}块,红包10000元=人民币1元`;
     }
     }
 
 
     addEvent() {
     addEvent() {
@@ -76,14 +77,16 @@ export class RedPackeWithdrawalViewComp extends CCVMParentComp {
         this.data.taskList = smc.game.GameModel.taskList;
         this.data.taskList = smc.game.GameModel.taskList;
         let wxCash = smc.game.GameModel.wxCash;
         let wxCash = smc.game.GameModel.wxCash;
         let hbCoin = Format.formatRedPacketCoin(smc.account.AccountModel.hbCoin);
         let hbCoin = Format.formatRedPacketCoin(smc.account.AccountModel.hbCoin);
-        this.lab_wxCash.string = `${wxCash}`;
-        this.lab_hbCoin.string = `${hbCoin}`;
+        // this.lab_wxCash.string = `${wxCash}`;
+        // this.lab_hbCoin.string = `${hbCoin}`;
+        this.data.wxCash = wxCash;
+        this.data.hbCoin = hbCoin;
         this.data.goldNum = smc.account.AccountModel.goldCoin;
         this.data.goldNum = smc.account.AccountModel.goldCoin;
         this.recordList.numItems = 0;
         this.recordList.numItems = 0;
         if (this.data.taskList.length > 0) {
         if (this.data.taskList.length > 0) {
             this.recordList.numItems = this.data.taskList.length;
             this.recordList.numItems = this.data.taskList.length;
         }
         }
-        this.lab_tips.string = `当前收集金砖${this.data.goldNum}块,红包10000元=人民币1元`;
+        // this.lab_tips.string = `当前收集金砖${this.data.goldNum}块,红包10000元=人民币1元`;
         oops.gui.toast("领取成功");
         oops.gui.toast("领取成功");
     }
     }
 
 
@@ -93,17 +96,8 @@ export class RedPackeWithdrawalViewComp extends CCVMParentComp {
         console.log("wxCash", wxCash);
         console.log("wxCash", wxCash);
         let hbCoin = Format.formatRedPacketCoin(smc.account.AccountModel.hbCoin);
         let hbCoin = Format.formatRedPacketCoin(smc.account.AccountModel.hbCoin);
         console.log("hbCoin", hbCoin);
         console.log("hbCoin", hbCoin);
-        if (this.lab_wxCash) {
-            this.lab_wxCash.string = `${wxCash}`;
-        } else {
-            console.log("找不到这个节点>>>>>>>", this.lab_wxCash)
-        }
-        if (this.lab_hbCoin) {
-            this.lab_hbCoin.string = `${hbCoin}`;
-        } else {
-            console.log("找不到这个节点", this.lab_hbCoin)
-        }
-
+        this.data.wxCash = wxCash;
+        this.data.hbCoin = hbCoin;
     }
     }
 
 
     private btn_back() {
     private btn_back() {
@@ -139,6 +133,12 @@ export class RedPackeWithdrawalViewComp extends CCVMParentComp {
     }
     }
 
 
 
 
+    protected onDestroy(): void {
+        oops.message.off(GameEvent.updateRedPackeTaskList, this.updateList, this);
+        oops.message.off(GameEvent.updateHbAndWxCoin, this.updateCoin, this);
+    }
+
+
     btn_text() {
     btn_text() {
         const info = { "ssid": "0cee6baebcb1413180e266d733510e38", "props": { "1007": 60, "9001": 5, "1005": 1889260, "1004": 5137068, "8001": 550, "1006": 9, "2001": 11, "1008": 30 }, "changes": { "8001": 500, "1004": -5000000 }, "money": 5.13, "transferStatus": 1, "outTransferNo": "2504281114186442061262848" }
         const info = { "ssid": "0cee6baebcb1413180e266d733510e38", "props": { "1007": 60, "9001": 5, "1005": 1889260, "1004": 5137068, "8001": 550, "1006": 9, "2001": 11, "1008": 30 }, "changes": { "8001": 500, "1004": -5000000 }, "money": 5.13, "transferStatus": 1, "outTransferNo": "2504281114186442061262848" }
         ServerHandler.inst.onHbReward(JSON.stringify(info));
         ServerHandler.inst.onHbReward(JSON.stringify(info));