Переглянути джерело

【优化】添加广告弹出次数统计

mojunshou 7 місяців тому
батько
коміт
9f334f2c15

+ 4 - 4
assets/bundle/gui/eliminate/prefab/doubleRewards.prefab

@@ -2623,7 +2623,7 @@
       "a": 255
     },
     "_spriteFrame": {
-      "__uuid__": "e738cfa2-f6eb-4ede-8229-6b75cf462678@f9941",
+      "__uuid__": "69f76d34-d8e0-43e7-a286-462c55c826cf@f9941",
       "__expectedType__": "cc.SpriteFrame"
     },
     "_type": 3,
@@ -3423,7 +3423,7 @@
       "a": 255
     },
     "_spriteFrame": {
-      "__uuid__": "e738cfa2-f6eb-4ede-8229-6b75cf462678@f9941",
+      "__uuid__": "69f76d34-d8e0-43e7-a286-462c55c826cf@f9941",
       "__expectedType__": "cc.SpriteFrame"
     },
     "_type": 3,
@@ -3435,7 +3435,7 @@
       "y": 0
     },
     "_fillStart": 0,
-    "_fillRange": 0,
+    "_fillRange": 0.7,
     "_isTrimmedMode": true,
     "_useGrayscale": false,
     "_atlas": null,
@@ -3548,7 +3548,7 @@
     },
     "_mode": 2,
     "_totalLength": 1,
-    "_progress": 0,
+    "_progress": 0.7,
     "_reverse": false,
     "_id": ""
   },

+ 1 - 1
assets/bundle/gui/eliminate/prefab/popup/wechatTransferring.prefab

@@ -9176,7 +9176,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 720,
-      "height": 1600
+      "height": 1600.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

+ 3 - 3
assets/bundle/gui/loading/loading.prefab

@@ -140,7 +140,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 720,
-      "height": 1600
+      "height": 1600.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",
@@ -290,7 +290,7 @@
     "_lpos": {
       "__type__": "cc.Vec3",
       "x": 0,
-      "y": -527.1499999999999,
+      "y": -527.1500000000001,
       "z": 0
     },
     "_lrot": {
@@ -1969,7 +1969,7 @@
     "_contentSize": {
       "__type__": "cc.Size",
       "width": 720,
-      "height": 1600
+      "height": 1600.0000000000002
     },
     "_anchorPoint": {
       "__type__": "cc.Vec2",

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

@@ -2,15 +2,13 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-07 10:17:16
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-28 10:19:29
+ * @LastEditTime: 2025-04-28 15:59:05
  * @Description: 消息定义
  */
 
-// const server_url = "http://192.168.10.103:8880";
+const server_url = "http://192.168.10.103:8880";
 // https://central-test.atmob.com
-const server_url = "https://central-test.atmob.com";
-
-
+// const server_url = "https://central-test.atmob.com";
 export enum ProtocolEvent {
     /**微信登录*/
     WechatLogin = server_url + "/project/playlet/v1/user/login",

+ 71 - 1
assets/script/game/model/GameModelComp.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-10 14:49:42
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-24 15:56:23
+ * @LastEditTime: 2025-04-28 16:40:03
  * @Description: 
  */
 import { ecs } from "db://oops-framework/libs/ecs/ECS";
@@ -181,6 +181,18 @@ export class GameModelComp extends ecs.Comp {
 
     //广告跳过次数配置
     _skipAdConfig: number = -1;
+
+
+    /**统计少量领取广告次数*/
+    _smallAdCount: number = 0;
+    /**统计点击全都要的统计次数*/
+    _allAdCount: number = 0;
+    /**统计直接弹出激励视频广告的统计次数*/
+    _directAdCount: number = 0;
+    /**二倍速视频广告统计*/
+    _doubleSpeedAdCount: number = 0;
+
+
     /** 数据层组件移除时,重置所有数据为默认值 */
     reset() {
         this.id = -1;
@@ -188,8 +200,66 @@ export class GameModelComp extends ecs.Comp {
         this.curLevelInfo = null!;
         this.curLevelConfig = null!;
         this.costInfo = null!;
+        this.recordList = [];
+        this.isShowAd = false;
+        this.price = 0;
+        this.isDone = false;
+        this.sign = "";
+        this.changeHbCoin = 0;
+        this.changeWxCoin = 0;
+        this.viewType = "";
+        this.txType = 1;
+        this.txNum = 0;
+        this.eventType = "";
+        this.wechat_tx_info = null!;
+        this.wxCash = 0;
+        this.taskList = null!;
+        this.doubleSpeedTime = 0;
+        this.doubleRewardInfo = null!;
+        this.loadbarInfo = null!;
+        this.popupType = "";
+        this.popupShow = false;
+        this.gameState = GameState.READY;
+        this.skipAdCount = 0;
+        this.skipAdConfig = -1;
+    }
+
+
+    set doubleSpeedAdCount(v: number) {
+        this._doubleSpeedAdCount = v;
+    }
+
+    get doubleSpeedAdCount() {
+        return this._doubleSpeedAdCount;
+    }
+
+
+    set smallAdCount(v: number) {
+        this._smallAdCount = v;
     }
 
+    get smallAdCount() {
+        return this._smallAdCount;
+    }
+
+    set allAdCount(v: number) {
+        this._allAdCount = v;
+    }
+
+    get allAdCount() {
+        return this._allAdCount;
+    }
+
+
+    set directAdCount(v: number) {
+        this._directAdCount = v;
+    }
+
+    get directAdCount() {
+        return this._directAdCount;
+    }
+
+
     set skipAdCount(v: number) {
         this._skipAdCount = v;
     }

+ 5 - 1
assets/script/game/view/DoubleRewardsView.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-03-21 11:57:43
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 16:41:14
+ * @LastEditTime: 2025-04-28 16:38:08
  * @Description: 惊喜翻倍弹窗
  */
 import { _decorator, instantiate, Label, Node, Prefab, UITransform } from 'cc';
@@ -76,6 +76,7 @@ export class DoubleRewardsView extends VMParent {
         this.setButton();
         this.setData();
         this.setAutoReceive();
+        oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
     }
 
 
@@ -86,6 +87,7 @@ export class DoubleRewardsView extends VMParent {
         DCHandler.inst.reportData(2000401);
         DCHandler.inst.reportData(2000403);
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
+        smc.game.GameModel.smallAdCount++;
     }
 
 
@@ -95,6 +97,7 @@ export class DoubleRewardsView extends VMParent {
         ADHandler.inst.showAd(AD_TYPE.Double_Receive);
         oops.gui.remove(UIID.DoubleRewards);
         oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
+        smc.game.GameModel.allAdCount++;
     }
 
 
@@ -112,6 +115,7 @@ export class DoubleRewardsView extends VMParent {
                     DCHandler.inst.reportData(2000402);
                     DCHandler.inst.reportData(2000403);
                     oops.message.dispatchEvent(GameEvent.updateGameState, "playing");
+                    smc.game.GameModel.smallAdCount++;
                 }
                 if (this.callback) {
                     this.unschedule(this.callback);

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

@@ -46,6 +46,7 @@ export class DoubleSpeedViewComp extends VMParent {
         smc.game.GameModel.viewType = "speed_reward";
         ADHandler.inst.showAd(AD_TYPE.Double_Speed_Receive);
         DCHandler.inst.reportData(3000301);
+        smc.game.GameModel.doubleSpeedAdCount++;
     }
 
 

+ 20 - 14
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-28 14:59:42
+ * @LastEditTime: 2025-04-28 16:38:40
  * @Description: 消除游戏主场景
  */
 import { _decorator, Button, Color, EventTouch, instantiate, JsonAsset, v3, Label, Node, Prefab, randomRangeInt, Sprite, tween, UITransform, Vec2, Vec3, Widget } from "cc";
@@ -351,6 +351,11 @@ export class EliminateViewComp extends CCComp {
         this.shouldResetEliminateCount = true;
         this.currentCombo = 0;
         this.autoNode.active = false;
+
+        smc.game.GameModel.smallAdCount = 0;
+        smc.game.GameModel.allAdCount = 0;
+        smc.game.GameModel.directAdCount = 0;
+        smc.game.GameModel.doubleSpeedAdCount = 0;
     }
 
     //设置数据
@@ -1580,24 +1585,25 @@ export class EliminateViewComp extends CCComp {
                                 console.log("最大随机数>>>>>>>>>", maxNum);
                                 console.log("消除总数>>>>>>>>>>>>>", this.eliminateTotal);
                                 console.log("randomNum随机数>>>>>>>>>>", randomNum);
+                                console.log("skipAdCount>>>>>>>>>>>>>>>", smc.game.GameModel.skipAdCount);
+                                console.log("skipAdConfig>>>>>>>>>>>>>>", smc.game.GameModel.skipAdConfig);
+                                //打印少量领取总数
+                                console.log("少量领取总数>>>>>>>>>>>>>>>", smc.game.GameModel.smallAdCount);
+                                //打印全都要总数
+                                console.log("全都要总数>>>>>>>>>>>>>>>", smc.game.GameModel.allAdCount);
+                                //打印直接弹出总数
+                                console.log("直接弹出总数>>>>>>>>>>>>>>>", smc.game.GameModel.directAdCount);
                                 if (this.eliminateTotal % randomNum === 0) {
                                     //如果有自动就暂停自动
                                     if (smc.game.GameModel.skipAdConfig != -1) {
                                         if (smc.game.GameModel.skipAdCount > 0 && smc.game.GameModel.skipAdCount % smc.game.GameModel.skipAdConfig == 0) {
-                                            console.log("skipAdCount>>>>>>>>>>>>>>>", smc.game.GameModel.skipAdCount);
-                                            console.log("skipAdConfig>>>>>>>>>>>>>>", smc.game.GameModel.skipAdConfig);
                                             smc.game.GameModel.viewType = "double_reward";
+                                            smc.game.GameModel.directAdCount++; //测试看
                                             ADHandler.inst.showAd(AD_TYPE.Double_Receive);
                                         } else {
-                                            if (this.autoState) {
-                                                this.gameState = GameState.PAUSED;
-                                            }
                                             ServerHandler.inst.getDoubleSurprise();
                                         }
                                     } else {
-                                        if (this.autoState) {
-                                            this.gameState = GameState.PAUSED;
-                                        }
                                         ServerHandler.inst.getDoubleSurprise();
                                     }
                                 }
@@ -1605,8 +1611,6 @@ export class EliminateViewComp extends CCComp {
                         }
                     }
                 }
-
-                // this.updateGameScore();
                 resolve(true)
             }, 0.1)
         })
@@ -2037,6 +2041,8 @@ export class EliminateViewComp extends CCComp {
         } else {
             oops.gui.open(UIID.DoubleSpeed);
         }
+
+        console.log("二倍速看视频统计>>>>>>>>>>>>>>>", smc.game.GameModel.doubleSpeedAdCount);
     }
 
 
@@ -2359,9 +2365,9 @@ export class EliminateViewComp extends CCComp {
         const showState = smc.game.GameModel.popupShow
         if (!showState) {
             //展示这些的时候,游戏要暂停
-            if (this.popupType != "") {
-                this.gameState = GameState.PAUSED;
-            }
+            // if (this.popupType != "") {
+            //     this.gameState = GameState.PAUSED;
+            // }
             switch (this.popupType) {
                 case "weal_1":
                     oops.gui.open(UIID.WarmReminder);

+ 1 - 0
assets/script/game/view/keepDoubleSpeedView.ts

@@ -60,6 +60,7 @@ export class keepDoubleSpeedView extends GameComponent {
     private openAd() {
         smc.game.GameModel.viewType = "speed_reward";
         ADHandler.inst.showAd(AD_TYPE.Double_Speed_Receive);
+        smc.game.GameModel.doubleSpeedAdCount++;
     }
 
     private btn_no() {

+ 3 - 2
assets/script/game/view/popup/ReservePopup.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-19 11:04:19
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-28 15:25:52
+ * @LastEditTime: 2025-04-28 16:32:06
  * @Description: 
  */
 import { _decorator } from 'cc';
@@ -14,6 +14,7 @@ import { smc } from '../../common/SingletonModuleComp';
 import { Format } from '../../utils/Format';
 import { DCHandler } from '../../common/manager/DCHandler';
 import { ServerHandler } from '../../common/manager/ServerHandler';
+import { GameEvent } from '../../common/config/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('ReservePopup')
@@ -25,11 +26,11 @@ export class ReservePopup extends VMParent {
         goldNum: 1
     }
 
-
     start() {
         DCHandler.inst.reportData(3000200);
         this.setButton();
         this.updateData();
+        oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
     }
 
     //更新数据

+ 9 - 0
assets/script/game/view/popup/WarmReminder.ts

@@ -1,13 +1,22 @@
+/*
+ * @Author: mojunshou 1637302775@qq.com
+ * @Date: 2025-04-18 19:10:06
+ * @LastEditors: mojunshou 1637302775@qq.com
+ * @LastEditTime: 2025-04-28 16:29:31
+ * @Description: 
+ */
 import { _decorator, Component, Node } from 'cc';
 import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
 import { UIID } from '../../common/config/GameUIConfig';
 import { oops } from 'db://oops-framework/core/Oops';
+import { GameEvent } from '../../common/config/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('WarmReminder')
 export class WarmReminder extends GameComponent {
     start() {
         this.setButton();
+        oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
     }
 
     btn_confirm() {

+ 3 - 1
assets/script/game/view/popup/WechatTransfer.ts

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-19 11:34:46
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 16:43:25
+ * @LastEditTime: 2025-04-28 16:32:36
  * @Description: 微信转账中界面
  */
 import { _decorator, Component, Node, Animation } from 'cc';
@@ -14,6 +14,7 @@ import { DeviceUtil } from 'db://oops-framework/core/utils/DeviceUtil';
 import { Format } from '../../utils/Format';
 import { DCHandler } from '../../common/manager/DCHandler';
 import { ServerHandler } from '../../common/manager/ServerHandler';
+import { GameEvent } from '../../common/config/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('WechatTransfer')
@@ -45,6 +46,7 @@ export class WechatTransfer extends VMParent {
 
 
     start() {
+        oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
         DCHandler.inst.reportData(3000201);
         this.setButton();
         this.showNode1.active = true;

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

@@ -2,7 +2,7 @@
  * @Author: mojunshou 1637302775@qq.com
  * @Date: 2025-04-19 10:27:15
  * @LastEditors: mojunshou 1637302775@qq.com
- * @LastEditTime: 2025-04-27 18:53:00
+ * @LastEditTime: 2025-04-28 16:31:22
  * @Description:官方承诺
  */
 import { _decorator, Component, Node, Animation } from 'cc';
@@ -11,6 +11,7 @@ import { GameComponent } from 'db://oops-framework/module/common/GameComponent';
 import { UIID } from '../../common/config/GameUIConfig';
 import { ServerHandler } from '../../common/manager/ServerHandler';
 import { smc } from '../../common/SingletonModuleComp';
+import { GameEvent } from '../../common/config/GameEvent';
 const { ccclass, property } = _decorator;
 
 @ccclass('WelfareThree')
@@ -23,6 +24,7 @@ export class WelfareThree extends GameComponent {
 
     start() {
         //3秒后打开官方承诺,关闭当前窗口
+        oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
         this.showNode1.active = true;
         this.showNode2.active = false;
         this.scheduleOnce(() => {

+ 2 - 0
assets/script/game/view/popup/WelfareTwo.ts

@@ -9,6 +9,7 @@ import { LoadBricsItem } from '../LoadBricsItem';
 import { UIID } from '../../common/config/GameUIConfig';
 import { oops } from 'db://oops-framework/core/Oops';
 import { ServerHandler } from '../../common/manager/ServerHandler';
+import { GameEvent } from '../../common/config/GameEvent';
 const { ccclass, property } = _decorator;
 
 interface LevelInfo {
@@ -55,6 +56,7 @@ export class WelfareTwo extends VMParent {
         this.showNode2.active = false;
         this.showWelfareTwo();
         this.updateData();
+        oops.message.dispatchEvent(GameEvent.updateGameState, "paused");
     }