Browse Source

【优化】修改了解锁自动放置的时机,修改了插屏广告的暂停方式逻辑

mojunshou 7 months ago
parent
commit
46dcf1bc63

+ 10 - 1
assets/script/game/common/manager/ADHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:14:44
  * @Date: 2025-04-11 10:14:44
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 16:54:22
+ * @LastEditTime: 2025-04-28 10:01:40
  * @Description: 
  * @Description: 
  */
  */
 // ADHandler.ts
 // ADHandler.ts
@@ -59,6 +59,7 @@ export class ADHandler {
             case AD_TYPE.Rebates:
             case AD_TYPE.Rebates:
             case AD_TYPE.Double_Speed_Close:
             case AD_TYPE.Double_Speed_Close:
                 method = 'ad.interstitial';
                 method = 'ad.interstitial';
+                param.callback.onShow = 'ADHandler.inst.adInterstitialonShow'
                 param.callback.onLoadFailed = 'ADHandler.inst.adInterstitialLoadFailed';
                 param.callback.onLoadFailed = 'ADHandler.inst.adInterstitialLoadFailed';
                 param.callback.onClose = 'ADHandler.inst.adInterstitialClose';
                 param.callback.onClose = 'ADHandler.inst.adInterstitialClose';
                 break;
                 break;
@@ -89,14 +90,22 @@ export class ADHandler {
         //加载实名认证
         //加载实名认证
     };
     };
 
 
+    //插屏广告展示的时候也要暂停
+    adInterstitialonShow = () => {
+        oops.message.dispatchEvent(GameEvent.pauseGame);
+    }
+
     adInterstitialLoadFailed = () => {
     adInterstitialLoadFailed = () => {
         console.log('[广告] 插屏广告加载失败');
         console.log('[广告] 插屏广告加载失败');
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
+        oops.message.dispatchEvent(GameEvent.resumeGame);
+
     };
     };
 
 
     adInterstitialClose = (type: boolean) => {
     adInterstitialClose = (type: boolean) => {
         console.log('[广告] 插屏广告关闭', type);
         console.log('[广告] 插屏广告关闭', type);
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
+        oops.message.dispatchEvent(GameEvent.resumeGame);
     };
     };
 
 
     adRewardShow = (str: string) => {
     adRewardShow = (str: string) => {

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

@@ -2,15 +2,13 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-07 10:17:16
  * @Date: 2025-04-07 10:17:16
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 16:57:57
+ * @LastEditTime: 2025-04-28 10:19:29
  * @Description: 消息定义
  * @Description: 消息定义
  */
  */
 
 
 // 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",
@@ -50,7 +48,6 @@ export enum ProtocolEvent {
     GetHbWithdrawInfo = server_url + "/project/playlet/v3/withdraw/view/detail",
     GetHbWithdrawInfo = server_url + "/project/playlet/v3/withdraw/view/detail",
     /**福利点提现*/
     /**福利点提现*/
     GetWelfarePointCash = server_url + "/project/playlet/v1/reward/weal",
     GetWelfarePointCash = server_url + "/project/playlet/v1/reward/weal",
-
     /**获取当前关卡配置信息*/
     /**获取当前关卡配置信息*/
     GetCurrentLevelConfig = server_url + "/project/playlet/v1/checkPoint/conf",
     GetCurrentLevelConfig = server_url + "/project/playlet/v1/checkPoint/conf",
     /**获取所有关卡配置信息*/
     /**获取所有关卡配置信息*/

+ 4 - 6
assets/script/game/common/manager/ServerHandler.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-11 10:16:41
  * @Date: 2025-04-11 10:16:41
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 16:18:46
+ * @LastEditTime: 2025-04-27 18:52:03
  * @Description: 
  * @Description: 
  */
  */
 // ServerHandler.ts
 // ServerHandler.ts
@@ -151,7 +151,7 @@ export class ServerHandler {
 
 
     onUserItemInfo(str: string) {
     onUserItemInfo(str: string) {
         const result = JSON.parse(str);
         const result = JSON.parse(str);
-        const props = result.data.props;
+        const props = result.props;
         const account = smc.account.AccountModel;
         const account = smc.account.AccountModel;
         const game = smc.game.GameModel;
         const game = smc.game.GameModel;
         account.wxCoin = props['1005'] || 0;
         account.wxCoin = props['1005'] || 0;
@@ -159,7 +159,6 @@ export class ServerHandler {
         account.goldCoin = props['1006'] || 0;
         account.goldCoin = props['1006'] || 0;
         game.handlingCharge = props['1009'] || 0;
         game.handlingCharge = props['1009'] || 0;
         //返回成功才登录
         //返回成功才登录
-
     }
     }
 
 
     //获取提现记录
     //获取提现记录
@@ -368,8 +367,7 @@ export class ServerHandler {
             oops.gui.toast("今日奖励已领取,请明天再来吧")
             oops.gui.toast("今日奖励已领取,请明天再来吧")
             return
             return
         }
         }
-        if (result?.props && !result.tipThreshold) {
-            console.log(">>>>>>>>>>>>>>发放奖励了")
+        if (result?.props) {
             const props = result.props;
             const props = result.props;
             const changes = result.changes;
             const changes = result.changes;
             const account = smc.account.AccountModel;
             const account = smc.account.AccountModel;
@@ -539,7 +537,7 @@ export class ServerHandler {
 
 
 
 
     //更新弹出事件
     //更新弹出事件
-    async updatePopupState(data: { level: number, type: string }) {
+    updatePopupState(data: { level: number, type: string }) {
         const param = {
         const param = {
             url: ProtocolEvent.UpdatePopUpState,
             url: ProtocolEvent.UpdatePopUpState,
             param: {
             param: {

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

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-20 15:40:20
  * @Date: 2025-03-20 15:40:20
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 17:45:39
+ * @LastEditTime: 2025-04-27 17:56:10
  * @Description:设置界面 
  * @Description:设置界面 
  */
  */
 import { _decorator } from "cc";
 import { _decorator } from "cc";
@@ -113,7 +113,6 @@ export class SettingViewComp extends CCVMParentComp {
         const btn_off = this.effectBtn.node.getChildByPath("btn_off")!;
         const btn_off = this.effectBtn.node.getChildByPath("btn_off")!;
         btn_on.active = this._effectState;
         btn_on.active = this._effectState;
         btn_off.active = !this._effectState;
         btn_off.active = !this._effectState;
-
     }
     }
 
 
 
 

+ 2 - 1
assets/script/game/view/DoubleSpeedViewComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-21 11:17:22
  * @Date: 2025-03-21 11:17:22
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 14:31:36
+ * @LastEditTime: 2025-04-28 10:09:02
  * @Description: 二倍速弹窗
  * @Description: 二倍速弹窗
  */
  */
 import { _decorator } from "cc";
 import { _decorator } from "cc";
@@ -37,6 +37,7 @@ export class DoubleSpeedViewComp extends VMParent {
     private btn_open() {
     private btn_open() {
         this.openAd();
         this.openAd();
         oops.gui.remove(UIID.DoubleSpeed);
         oops.gui.remove(UIID.DoubleSpeed);
+        //这有点问题
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
     }
     }
 
 

+ 29 - 58
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-27 16:20:21
+ * @LastEditTime: 2025-04-27 19:02:38
  * @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";
@@ -1573,6 +1573,10 @@ export class EliminateViewComp extends CCComp {
                             if (minNum && maxNum) {
                             if (minNum && maxNum) {
                                 const randomNum = randomRangeInt(minNum, maxNum + 1);
                                 const randomNum = randomRangeInt(minNum, maxNum + 1);
                                 //这个数可以被总消除次数整除那就可以弹广告
                                 //这个数可以被总消除次数整除那就可以弹广告
+                                console.log("最小随机数>>>>>>>>>", minNum);
+                                console.log("最大随机数>>>>>>>>>", maxNum);
+                                console.log("消除总数>>>>>>>>>>>>>", this.eliminateTotal);
+                                console.log("randomNum随机数>>>>>>>>>>", randomNum);
                                 if (this.eliminateTotal % randomNum === 0) {
                                 if (this.eliminateTotal % randomNum === 0) {
                                     //如果有自动就暂停自动
                                     //如果有自动就暂停自动
                                     if (smc.game.GameModel.skipAdConfig != -1) {
                                     if (smc.game.GameModel.skipAdConfig != -1) {
@@ -2382,66 +2386,33 @@ export class EliminateViewComp extends CCComp {
     }
     }
 
 
     btn_text() {
     btn_text() {
-        // const param = {
-        //     "showReward": [
-        //         {
-        //             "propId": "1004",
-        //             "propNum": 500
-        //         },
-        //         {
-        //             "propId": "1005",
-        //             "propNum": 200
-        //         },
-        //         {
-        //             "propId": "1006",
-        //             "propNum": 1
-        //         }
-        //     ],
-        //     "levelProgress": {
-        //         "nextProgress": 1,
-        //         "levelInfoList": [
-        //             {
-        //                 "level": 1,
-        //                 "eventType": "WITHDRAW_POINT",
-        //                 "withdraw": true
-        //             },
-        //             {
-        //                 "level": 4,
-        //                 "eventType": "WITHDRAW_POINT",
-        //                 "withdraw": false
-        //             },
-        //             {
-        //                 "level": 6,
-        //                 "eventType": "WITHDRAW_POINT",
-        //                 "withdraw": false
-        //             },
-        //             {
-        //                 "level": 8,
-        //                 "eventType": "WITHDRAW_POINT",
-        //                 "withdraw": false
-        //             },
-        //             {
-        //                 "level": 12,
-        //                 "eventType": "SIGN_POINT",
-        //                 "withdraw": false
-        //             }
-        //         ]
-        //     }
-        // }
-        // let str = JSON.stringify(param);
-        // ServerHandler.inst.onDoubleSurprise(str);
+        const param = {
+            "code": 0,
+            "data": {
+                "ssid": "9201d75d019f46f98b8663adfd515a58",
+                "props": {
+                    "1004": 7077279,
+                    "1005": 2143634,
+                    "1006": 12,
+                    "1007": 186,
+                    "1008": 22,
+                    "1009": 299980,
+                    "2001": 2,
+                    "8001": 530,
+                    "9001": 2
+                },
+                "changes": {
+                    "1004": 1,
+                    "1007": 1
+                },
+                "tipThreshold": true
+            }
+        }
+        let str = JSON.stringify(param);
+        ServerHandler.inst.onGetVideorReward(str);
         // ServerHandler.inst.GetGuideInfo();
         // ServerHandler.inst.GetGuideInfo();
     }
     }
 
 
-
-
-
-
-
-
-
-
-
     getRandomUniqueInts(count: number = 3): number[] {
     getRandomUniqueInts(count: number = 3): number[] {
         let min: number = 0;
         let min: number = 0;
         let max: number = 0;
         let max: number = 0;

+ 2 - 2
assets/script/game/view/popup/UnlockFunction.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-18 19:35:48
  * @Date: 2025-04-18 19:35:48
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-19 10:20:50
+ * @LastEditTime: 2025-04-27 18:52:30
  * @Description: 解锁功能
  * @Description: 解锁功能
  */
  */
 import { _decorator, Component, Node } from 'cc';
 import { _decorator, Component, Node } from 'cc';
@@ -18,7 +18,6 @@ const { ccclass, property } = _decorator;
 export class UnlockFunction extends GameComponent {
 export class UnlockFunction extends GameComponent {
     start() {
     start() {
         this.setButton();
         this.setButton();
-        this.updateState();
     }
     }
 
 
 
 
@@ -26,6 +25,7 @@ export class UnlockFunction extends GameComponent {
         oops.gui.remove(UIID.UnlockFunction);
         oops.gui.remove(UIID.UnlockFunction);
         //发送开始自动玩游戏
         //发送开始自动玩游戏
         oops.message.dispatchEvent(GameEvent.StartAutoGame);
         oops.message.dispatchEvent(GameEvent.StartAutoGame);
+        this.updateState();
     }
     }
 
 
 
 

+ 4 - 10
assets/script/game/view/popup/WelfareOne.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-18 19:11:51
  * @Date: 2025-04-18 19:11:51
  * @LastEditors: mojunshou 1637302775@qq.com
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-24 16:30:58
+ * @LastEditTime: 2025-04-27 18:52:48
  * @Description: 福利一
  * @Description: 福利一
  */
  */
 import { _decorator, Animation, instantiate, Node, Prefab } from 'cc';
 import { _decorator, Animation, instantiate, Node, Prefab } from 'cc';
@@ -109,21 +109,15 @@ export class WelfareOne extends VMParent {
         if (animation) {
         if (animation) {
             animation.play();
             animation.play();
         }
         }
-        this.updateState();
         //3秒后关闭
         //3秒后关闭
         this.scheduleOnce(() => {
         this.scheduleOnce(() => {
+            // this.updateState();
+            //展示解锁
+            oops.gui.open(UIID.UnlockFunction);
             oops.gui.remove(UIID.WelfareOne);
             oops.gui.remove(UIID.WelfareOne);
         }, 3)
         }, 3)
     }
     }
 
 
-    updateState() {
-        ServerHandler.inst.updatePopupState({
-            level: smc.account.AccountModel.curLevel,
-            type: smc.game.GameModel.popupType
-        })
-
-    }
-
     processLevelInfo(levelInfoList: LevelInfo[], totalLength: number = 602): LevelInfo[] {
     processLevelInfo(levelInfoList: LevelInfo[], totalLength: number = 602): LevelInfo[] {
         if (levelInfoList.length === 0) return [];
         if (levelInfoList.length === 0) return [];
         const firstLevel = levelInfoList[0].level;
         const firstLevel = levelInfoList[0].level;

+ 8 - 1
assets/script/game/view/popup/WelfareThree.ts

@@ -1,3 +1,10 @@
+/*
+ * @Author: mojunshou 1637302775@qq.com
+ * @Date: 2025-04-19 10:27:15
+ * @LastEditors: mojunshou 1637302775@qq.com
+ * @LastEditTime: 2025-04-27 18:53:00
+ * @Description:官方承诺
+ */
 import { _decorator, Component, Node, Animation } from 'cc';
 import { _decorator, Component, Node, Animation } from 'cc';
 import { oops } from 'db://oops-framework/core/Oops';
 import { oops } from 'db://oops-framework/core/Oops';
 import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
 import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
@@ -29,9 +36,9 @@ export class WelfareThree extends GameComponent {
 
 
             //3秒后打开官方承诺,关闭当前窗口
             //3秒后打开官方承诺,关闭当前窗口
             this.scheduleOnce(() => {
             this.scheduleOnce(() => {
+                this.updateState();
                 oops.gui.remove(UIID.WelfareThree);
                 oops.gui.remove(UIID.WelfareThree);
             }, 5)
             }, 5)
-            this.updateState();
 
 
         }, 3)
         }, 3)
     }
     }

+ 11 - 1
assets/script/game/view/popup/WelfareTwo.ts

@@ -8,6 +8,7 @@ import { smc } from '../../common/SingletonModuleComp';
 import { LoadBricsItem } from '../LoadBricsItem';
 import { LoadBricsItem } from '../LoadBricsItem';
 import { UIID } from '../../common/config/GameUIConfig';
 import { UIID } from '../../common/config/GameUIConfig';
 import { oops } from 'db://oops-framework/core/Oops';
 import { oops } from 'db://oops-framework/core/Oops';
+import { ServerHandler } from '../../common/manager/ServerHandler';
 const { ccclass, property } = _decorator;
 const { ccclass, property } = _decorator;
 
 
 interface LevelInfo {
 interface LevelInfo {
@@ -77,7 +78,8 @@ export class WelfareTwo extends VMParent {
         }
         }
         //3秒后关闭
         //3秒后关闭
         this.scheduleOnce(() => {
         this.scheduleOnce(() => {
-            oops.gui.open(UIID.UnlockFunction);
+            // oops.gui.open(UIID.UnlockFunction);
+            this.updateState();
             oops.gui.remove(UIID.WelfareTwo);
             oops.gui.remove(UIID.WelfareTwo);
             //解锁新功能
             //解锁新功能
         }, 3)
         }, 3)
@@ -135,6 +137,14 @@ export class WelfareTwo extends VMParent {
             return item;
             return item;
         });
         });
     }
     }
+
+    updateState() {
+        ServerHandler.inst.updatePopupState({
+            level: smc.account.AccountModel.curLevel,
+            type: smc.game.GameModel.popupType
+        })
+
+    }
 }
 }