Selaa lähdekoodia

【BUG】修改复活点击广告,没看完不能重新进行游戏问题

mojunshou 7 kuukautta sitten
vanhempi
commit
e4437b57e0

+ 5 - 3
assets/script/game/common/manager/ADHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:14:44
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-25 15:27:07
+ * @LastEditTime: 2025-04-25 16:52:33
  * @Description: 
  */
 // ADHandler.ts
@@ -127,7 +127,6 @@ export class ADHandler {
         oops.gui.waitClose();
         smc.game.GameModel.isShowAd = false;
         console.log("[广告] 激励视频关闭", state)
-        smc.game.GameModel.isDone = state;
         if (state) {
             //看完了可以领取奖励
             ServerHandler.inst.getVideorReward();
@@ -139,13 +138,16 @@ export class ADHandler {
             //如果是复活,分数减半
             if (smc.game.GameModel.viewType === "revive_reward") {
                 smc.game.GameModel.viewType = "";
-                oops.message.dispatchEvent(GameEvent.RestartGame);
+                ServerHandler.inst.RestartGame();
             }
         } else {
             //通关奖励,没看完也能过下一关
             if (smc.game.GameModel.viewType == "pass_reward") {
                 smc.game.GameModel.viewType = "";
                 ServerHandler.inst.getNextLevel();
+            } else if (smc.game.GameModel.viewType === "revive_reward") {
+                smc.game.GameModel.viewType = "";
+                ServerHandler.inst.RestartGame();
             }
         }
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing"); //要判断是暂停才可以继续

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

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-07 10:17:16
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-24 17:50:59
+ * @LastEditTime: 2025-04-25 16:38:52
  * @Description: 消息定义
  */
 
@@ -10,6 +10,7 @@
 // https://central-test.atmob.com
 const server_url = "https://central-test.atmob.com";
 
+
 export enum ProtocolEvent {
     /**微信登录*/
     WechatLogin = server_url + "/project/playlet/v1/user/login",

+ 19 - 19
assets/script/game/common/manager/ServerHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:16:41
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-25 15:03:43
+ * @LastEditTime: 2025-04-25 16:36:40
  * @Description: 
  */
 // ServerHandler.ts
@@ -240,7 +240,7 @@ export class ServerHandler {
             url: ProtocolEvent.GetEliminationReward,
             param: {
                 eliminationCount: data.count,
-                level: data.level,
+                // level: data.level,
                 score: data.score
             },
             callback: this.buildCallback('ServerHandler.inst.onEliminationSuccess', 'ServerHandler.inst.onRequestFail')
@@ -282,12 +282,12 @@ export class ServerHandler {
 
     //直接领取通关奖励
     getPassRewards() {
-        const level = smc.account.AccountModel.curLevel;
+        // const level = smc.account.AccountModel.curLevel;
         const param = {
             url: ProtocolEvent.GetPassReward,
-            param: {
-                level: level,
-            },
+            // param: {
+            //     level: level,
+            // },
             callback: this.buildCallback('ServerHandler.inst.onGetPassRewards', 'ServerHandler.inst.onRequestFail')
         }
         this.sendMsgToServer(param);
@@ -316,12 +316,12 @@ export class ServerHandler {
 
     //少量领取翻倍奖励
     getLittleRewards() {
-        const level = smc.account.AccountModel.curLevel;
+        // const level = smc.account.AccountModel.curLevel;
         const param = {
             url: ProtocolEvent.GetLittlePassReward,
-            param: {
-                level: level,
-            },
+            // param: {
+            //     level: level,
+            // },
             callback: this.buildCallback('ServerHandler.inst.onGetDoubleRewards', 'ServerHandler.inst.onRequestFail')
         }
         this.sendMsgToServer(param);
@@ -342,13 +342,13 @@ export class ServerHandler {
     //获取视频奖励
     getVideorReward() {
         const sign = smc.game.GameModel.sign;
-        const level = smc.account.AccountModel.curLevel;
+        // const level = smc.account.AccountModel.curLevel;
         let type = smc.game.GameModel.viewType;
         console.log("获取视频奖励类型", type)
         const param = {
             url: ProtocolEvent.GetVideorReward,
             param: {
-                level: level,
+                // level: level,
                 type: type,
                 transId: "",
                 sign: sign
@@ -390,12 +390,12 @@ export class ServerHandler {
 
     //下一关
     getNextLevel() {
-        const level = smc.account.AccountModel.curLevel;
+        // const level = smc.account.AccountModel.curLevel;
         const param = {
             url: ProtocolEvent.NextLevel,
-            param: {
-                nextLevel: level + 1
-            },
+            // param: {
+            //     nextLevel: level + 1
+            // },
             callback: this.buildCallback('ServerHandler.inst.onGetNextLevel', 'ServerHandler.inst.onRequestFail')
         }
         this.sendMsgToServer(param);
@@ -568,9 +568,9 @@ export class ServerHandler {
     getFee() {
         const param = {
             url: ProtocolEvent.GetFee,
-            param: {
-                level: smc.account.AccountModel.curLevel,
-            },
+            // param: {
+            //     level: smc.account.AccountModel.curLevel,
+            // },
             callback: this.buildCallback('ServerHandler.inst.onGetFee', 'ServerHandler.inst.onRequestFail')
         }
         this.sendMsgToServer(param);

+ 3 - 1
assets/script/game/common/setting/SettingViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:40:20
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-23 15:50:37
+ * @LastEditTime: 2025-04-25 16:33:49
  * @Description:设置界面 
  */
 import { _decorator } from "cc";
@@ -148,7 +148,9 @@ export class SettingViewComp extends CCVMParentComp {
             DCHandler.inst.reportData(3001002);
         } else {
             DCHandler.inst.reportData(3001003);
+            oops.audio.music.play();
         }
+        console.log(">>>>>>>>>>>>oops.audio.musicVolume", oops.audio.volumeMusic)
         oops.storage.set("music_state", this._musicState);
         oops.audio.switchMusic = this._musicState;
         const btn_on = this.musicBtn.node.getChildByPath("btn_on")!;

+ 2 - 2
assets/script/game/view/EliminateViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:01:09
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-25 16:03:04
+ * @LastEditTime: 2025-04-25 16:44:26
  * @Description: 消除游戏主场景
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -287,7 +287,7 @@ export class EliminateViewComp extends CCComp {
                 break;
             case "playing":
                 this.scheduleOnce(() => {
-                    if (this.gameState == GameState.PAUSED) {
+                    if (this.gameState == GameState.PAUSED || this.autoState && this.gameState == GameState.GAME_OVER) {
                         this.gameState = GameState.PLAYING;
                     }
                 }, 0.5)