wuwangdong 4 gadi atpakaļ
vecāks
revīzija
ccca3b1b84

+ 2 - 0
assets/script/before/main/FarmIcon.ts

@@ -165,6 +165,8 @@ export class FarmIcon extends cc.Component {
         else {
             gData.farmGradeData.addGradeExp(ExpAddType.EAT_others, this.node);
         }
+
+        gData.gameData.popTableScreenADLogic(7);
     }
 
     public async plant(id: number, parentNode = null) {

+ 1 - 1
assets/script/before/view/ui/ADClearSickPanel.ts

@@ -35,7 +35,7 @@ export default class ADClearSickPanel extends cc.Component {
     }
 
     onEnable() {
-        gData.adData.checkPopInter(InterAdType.interstitial1_click_3);
+        gData.gameData.popTableScreenADLogic(2);
 
         //mk.ad.showBanner(BannerAdType.banner_click_8);
         mk.ad.showNative();

+ 2 - 0
assets/script/before/view/ui/ADUnlockPanel.ts

@@ -14,6 +14,8 @@ export default class ADUnlockPanel extends cc.Component {
                 mk.ui.closePanel(this.node.name);
                 gData.adData.watchVideo(null);
                 gData.adUnlockData.unlockFarm();
+
+                gData.gameData.popTableScreenADLogic(16);
             }
         });
     }

+ 2 - 0
assets/script/before/view/ui/HarvestPanel.ts

@@ -62,6 +62,8 @@ export default class HarvestPanel extends cc.Component {
             mk.console.log("watchAD:" + success);
             if (success) {
                 await gData.adData.watchVideo(AdFun.harvest);
+
+                gData.gameData.popTableScreenADLogic(17);
             }
         });
     }

+ 56 - 26
assets/script/game/data/AdData.ts

@@ -1,6 +1,6 @@
 import Util from "../../before/util/Util";
 import { Data } from "../../mk/data/Data";
-import { GameProp, VideoAdType } from "./GameData";
+import { GameProp, InterAdType, VideoAdType } from "./GameData";
 
 /**
  * @description 广告数据
@@ -104,7 +104,7 @@ export class AdData {
         this.precision = data.precision;
         this.ecpm_level = data.ecpm_level;
         this.request_id = '';
-        if(data.ext_info && data.ext_info.request_id){
+        if (data.ext_info && data.ext_info.request_id) {
             this.request_id = data.ext_info.request_id;
         }
     }
@@ -157,11 +157,10 @@ export class AdData {
             curData.setAdData(response.data);
         }
 
-        if(callBack)
-        {
+        if (callBack) {
             callBack(response.data);
         }
-        
+
         //达到任务之后计算视频
         if (gData.safeDepositBoxData.isStartBankTask > 0) {
             gData.safeDepositBoxData.richBankDailyVideoTimes++
@@ -231,7 +230,7 @@ export class AdData {
                 "platformRisk": 1,
                 "request_id": '',
             }
-            if(data.ext_info && data.ext_info.request_id){
+            if (data.ext_info && data.ext_info.request_id) {
                 sData.request_id = data.ext_info.request_id;
             }
         }
@@ -292,12 +291,16 @@ export class AdData {
     /** 检查是否显示插屏、互推(概率弹出)
      * @type  1:弹出全屏插屏广告  2:延时弹出大插屏  3:先弹出插屏,再弹出大插屏  4:互推红包
      */
-    checkShowFullInter(type, des = null) {
+    checkShowFullInter(type, des = null, rateType = null) {
         let per = 0;
         let pop = true;
         switch (type) {
             case 1:
-                per = this.getPerByEcpm(RateConfig.RC_fullScreen);
+                if (rateType != null) {
+                    per = this.getPerByEcpm(rateType);
+                } else {
+                    per = this.getPerByEcpm(RateConfig.RC_fullScreen);
+                }
                 pop = Math.random() < per;
                 if (!pop) {
                     return pop;
@@ -308,7 +311,11 @@ export class AdData {
                 mk.ad.showInterAd(1, des);
                 break;
             case 2:
-                per = this.getPerByEcpm(RateConfig.RC_tableScreen);
+                if (rateType != null) {
+                    per = this.getPerByEcpm(rateType);
+                } else {
+                    per = this.getPerByEcpm(RateConfig.RC_tableScreen);
+                }
                 pop = Math.random() < per;
                 if (!pop) {
                     return pop;
@@ -322,8 +329,11 @@ export class AdData {
                 }, delay);
                 break;
             case 3:
-
-                per = this.getPerByEcpm(RateConfig.RC_tableScreen);
+                if (rateType != null) {
+                    per = this.getPerByEcpm(rateType);
+                } else {
+                    per = this.getPerByEcpm(RateConfig.RC_tableScreen);
+                }
                 pop = Math.random() < per;
                 if (!pop) {
                     return pop;
@@ -341,6 +351,11 @@ export class AdData {
                 }, delay1);
                 break;
             case 4:
+                if (rateType != null) {
+                    per = this.getPerByEcpm(rateType);
+                } else {
+                    per = this.getPerByEcpm(RateConfig.RC_moreGameRedBag);
+                }
                 per = this.getPerByEcpm(RateConfig.RC_moreGameRedBag);
                 pop = Math.random() < per;
                 if (!pop) {
@@ -354,7 +369,7 @@ export class AdData {
     }
 
     /** 弹出插屏 */
-    checkPopInter(des) {
+    checkPopInter(des, rateType = null) {
         if (this.ABCInsertAdArr.indexOf(this.ecpmLevel.toString()) == -1) {
             return;
         }
@@ -369,7 +384,7 @@ export class AdData {
             }
         }
 
-        this.checkShowFullInter(index, des);
+        this.checkShowFullInter(index, des, rateType);
     }
 
     /** 点击提现弹出全屏插屏 */
@@ -411,9 +426,21 @@ export class AdData {
         let span = this.AutoRedMoneyMap.get(this.ecpmLevel);
         if (this.timeAd >= span) {
             this.timeAd = 0;
-            mk.ad.videoAdType = VideoAdType.video_init_19;
-            gData.gameData.init_hideRedBag = true;
-            mk.ui.openPanel('module/newOpenRedBag/newOpenRedBag');
+            // mk.ad.videoAdType = VideoAdType.video_init_19;
+            // gData.gameData.init_hideRedBag = true;
+            // mk.ui.openPanel('module/newOpenRedBag/newOpenRedBag');
+
+            //this.checkPopInter(InterAdType.interstitial1_click_19);
+
+            if (gData.gameData.insertAdSwitch[13] == "1") {
+                mk.ad.videoAdType = VideoAdType.video_init_22;
+                mk.ad.watchAd((success: boolean) => {
+                    mk.console.log("watchAD:" + success);
+                    if (success) {
+                        gData.adData.watchVideo(null);
+                    }
+                });
+            }
         }
     }
 
@@ -492,10 +519,15 @@ export class AdData {
                         return per;
                     }
                 case RateConfig.RC_popSpeedUp:
-                    if (gData.gameData.adShowConfig.average_ecpm <= parseInt(forceAd[i].ecpmMax)){
+                    if (gData.gameData.adShowConfig.average_ecpm <= parseInt(forceAd[i].ecpmMax)) {
                         per = parseFloat(forceAd[i].jsPercent);
                         return per;
                     }
+                case RateConfig.RC_afterVideo:
+                    if (gData.gameData.adShowConfig.average_ecpm <= parseInt(forceAd[i].ecpmMax)) {
+                        per = parseFloat(forceAd[i].cpjlPercent);
+                        return per;
+                    }
             }
         }
 
@@ -508,8 +540,7 @@ export class AdData {
         if (!times) {
             console.log('savePreLoadEcpm  data ', data.adsource_price)
             let response = await mk.http.sendData('user/savePreLoadEcpm', data);
-            if(response.errcode != 0)
-            {
+            if (response.errcode != 0) {
                 return;
             }
 
@@ -517,17 +548,15 @@ export class AdData {
         }
     }
 
-    async getOrderTaskInfo(isDefault)
-    {
-        if(!gData.gameData.playerProp.orderData)
-        {
+    async getOrderTaskInfo(isDefault) {
+        if (!gData.gameData.playerProp.orderData) {
             let data = {};
             data["isDefault"] = isDefault;
             let response = await mk.http.sendData('orderTask/getUserOrderTaskInfo', data);
-            if(response.errcode != 0){
+            if (response.errcode != 0) {
                 return;
             }
-            gData.gameData.playerProp.orderData = response.data.userOrderTaskInfo;  
+            gData.gameData.playerProp.orderData = response.data.userOrderTaskInfo;
 
             mk.event.emit("initOrderUi");
         }
@@ -559,5 +588,6 @@ export enum RateConfig {
     RC_splash,
     RC_superDouble,
     RC_moreGameRedBag,
-    RC_popSpeedUp
+    RC_popSpeedUp,
+    RC_afterVideo
 }

+ 104 - 3
assets/script/game/data/GameData.ts

@@ -129,6 +129,9 @@ export class GameData {
 
     //富翁银行教学
     richBankTeachTag = false;
+
+    public insertAdLimit = 0;
+    public insertAdSwitch: string[] = [];
     /**
      * 初始化游戏数据:网络配置信息,用户信息
      * @returns 
@@ -220,6 +223,9 @@ export class GameData {
         }else{
             LogUtil.ifShowLog = false;
         }
+
+        gData.gameData.insertAdLimit = parseInt(this.configs.ServerConfig.InsertAdCash);
+        gData.gameData.insertAdSwitch = this.configs.ServerConfig.InsertAdScene.split(",");
     }
 
     /**
@@ -440,7 +446,7 @@ export class GameData {
         this.initProductTimes();
         this.initLeftTimes();
         this.initFarmMapGetRewardData();
-        this.initCashOutTimes();
+        //this.initCashOutTimes();
         // let isNewTask = this.getProp(GameProp.redBagTaskRefresh);
         // if (isNewTask != undefined) {
         //     this.init_redBagTask = isNewTask;
@@ -1882,6 +1888,81 @@ export class GameData {
             console.log("------");
         }
     }
+
+    popTableScreenADLogic(type: number) {
+        let str = null;
+        switch (type) {
+            case 0:
+                str = InterAdType.interstitial1_click_1;
+                break;
+            case 1:
+                str = InterAdType.interstitial1_click_2;
+                break;
+            case 2:
+                str = InterAdType.interstitial1_click_3;
+                break;
+            case 3:
+                str = InterAdType.interstitial1_click_4;
+                break;
+            case 4:
+                str = InterAdType.interstitial1_click_5;
+                break;
+            case 5:
+                str = InterAdType.interstitial1_click_6;
+                break;
+            case 6:
+                str = InterAdType.interstitial1_click_7;
+                break;
+            case 7:
+                str = InterAdType.interstitial1_click_8;
+                break;
+            case 8:
+                str = InterAdType.interstitial1_click_9;
+                break;
+            case 9:
+                str = InterAdType.interstitial1_click_10;
+                break;
+            case 10:
+                str = InterAdType.interstitial1_click_11;
+                break;
+            case 11:
+                str = InterAdType.interstitial1_click_12;
+                break;
+            case 12:
+                str = InterAdType.interstitial1_click_13;
+                break;
+            case 13:
+                str = InterAdType.interstitial1_click_14;
+                break;
+            case 14:
+                str = InterAdType.interstitial1_click_15;
+                break;
+            case 15:
+                str = InterAdType.interstitial1_click_16;
+                break;
+            case 16:
+                str = InterAdType.interstitial1_click_17;
+                break;
+            case 17:
+                str = InterAdType.interstitial1_click_18;
+                break;
+        }
+        let index = 0;
+        let rateType = null;
+        if(type <= 11){
+            index = type;
+        }else{
+            index = 12;
+            rateType = RateConfig.RC_afterVideo;
+        }
+        if(str != null){
+            let cashTimes = gData.gameData.getProp(GameProp.cashTimes);
+            let is = gData.gameData.insertAdSwitch[index];
+            if(is == "1" && cashTimes >= gData.gameData.insertAdLimit){
+                gData.adData.checkPopInter(str, rateType);
+            }
+        }
+    }
 }
 
 /**
@@ -2205,6 +2286,8 @@ export enum EVENT_TYPE {
 
 
 /** 数据事件Id */
+
+
 export enum DataEventId {
     /** 点击 */
     guide = "guide",
@@ -2245,7 +2328,8 @@ export enum DataEventId {
     /**互推红包弹出位置 */
     htRedBag_scene = "htRedBag_scene",
     /**互推红包领取次数*/
-    htRedBag_eject = "htRedBag_eject"
+    htRedBag_eject = "htRedBag_eject",
+    interstita11_eject = "interstita11_eject"
 }
 
 
@@ -2272,6 +2356,7 @@ export enum VideoAdType {
     video_init_19 = '定时弹出红包',
     video_init_20 = '插队',
     video_init_21 = '恢复生产次数',
+    video_init_22 = '长时间未操作弹出视频',
 }
 
 export enum InterFullAdType {
@@ -2283,7 +2368,23 @@ export enum InterFullAdType {
 export enum InterAdType {
     interstitial1_click_1 = '恭喜发财红包弹出后',
     interstitial1_click_2 = '恭喜获得弹窗弹出后',
-    interstitial1_click_3 = '生虫/生病/停电弹出后'
+    interstitial1_click_3 = '生虫/生病/停电弹出后',
+    interstitial1_click_4 = '关闭抽奖界面后',
+    interstitial1_click_5 = '关闭任务红包后',
+    interstitial1_click_6 = '关闭富翁银行后',
+    interstitial1_click_7 = '打开领取生产次数界面',
+    interstitial1_click_8 = '农作物点击可收获',
+    interstitial1_click_9 = '关闭全体加速后',
+    interstitial1_click_10 = '关闭福利后',
+    interstitial1_click_11 = '打开个人资料页',
+    interstitial1_click_12 = '打开更多游戏页',
+    interstitial1_click_13 = '全体加速激励视频播完后',
+    interstitial1_click_14 = '离线奖励激励视频播完后',
+    interstitial1_click_15 = '抽奖激励视频播完后',
+    interstitial1_click_16 = '图鉴领奖激励视频播完后',
+    interstitial1_click_17 = '拓建激励视频播完后',
+    interstitial1_click_18 = '收获超级加倍激励视频播完后',
+    //interstitial1_click_19 = '定时弹出插屏',
 }
 
 export enum BannerAdType {

+ 1 - 1
assets/script/game/data/module/BlessingBagData.ts

@@ -124,7 +124,7 @@ export class BlessingBagData extends Data {
         mk.data.sendDataEvent(DataEventId.fudaiFunction, `视频红包第${this.taskRbId}档提现成功`);
         mk.data.sendDataEvent(DataEventId.Sundry, '福利提现成功');
         gData.gameData.doPointToXYLogic();
-        gData.gameData.addCashOutTimes();
+        //gData.gameData.addCashOutTimes();
 
         gData.receiptNotice.receip_rmb = gData.blessingBag.rbNum;
         mk.ui.openPanel('module/newNotice/newNotice');

+ 1 - 1
assets/script/game/data/module/GradeRewardData.ts

@@ -36,7 +36,7 @@ export class GradeRewardData extends Data {
         mk.data.sendDataEvent(DataEventId.Sundry, '农场等级奖励提现成功');
         gData.gameData.doPointToXYLogic();
 
-        gData.gameData.addCashOutTimes();
+        //gData.gameData.addCashOutTimes();
 
         this.changeExp = true;
         gData.gameData.playerProp.farmGradeData = response.data.userFarmGrageRewardInfo

+ 1 - 1
assets/script/game/data/module/SignData.ts

@@ -151,7 +151,7 @@ export class SignData extends Data {
                 return;
             }
 
-            gData.gameData.addCashOutTimes();
+            //gData.gameData.addCashOutTimes();
             const rewardNum = Math.round(adData.videoRedMoney.videoRewardList[0].rewardNum * 100);
             gData.receiptNotice.receip_rmb = rewardNum;
             mk.ui.openPanel('module/newNotice/newNotice', OpenActionType.closeLast);

+ 2 - 2
assets/script/game/data/module/WalletCashOutData.ts

@@ -40,7 +40,7 @@ export class WalletCashOutData extends Data {
         gData.safeDepositBoxData.updateQipao();
         gData.cashNormal.getRecord();
         gData.gameData.doPointToXYLogic();
-        gData.gameData.addCashOutTimes();
+        //gData.gameData.addCashOutTimes();
     }
 
     async addProgress() {
@@ -103,7 +103,7 @@ export class WalletCashOutData extends Data {
         gData.cashNormal.getRecord();
         mk.data.sendDataEvent(DataEventId.Sundry, '红包币提现成功');
         gData.gameData.doPointToXYLogic();
-        gData.gameData.addCashOutTimes();
+        //gData.gameData.addCashOutTimes();
     }
 
 }

+ 5 - 0
assets/script/game/module/blessingBag/BlessingBag.ts

@@ -297,4 +297,9 @@ export default class BlessingBag extends cc.Component {
             mk.data.sendDataEvent(DataEventId.htRedBag_scene, "关闭福利界面");
         }
     }
+
+    onDestroy(){
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_10);
+        gData.gameData.popTableScreenADLogic(9);
+    }
 }

+ 3 - 1
assets/script/game/module/farmMap/FarmItem.ts

@@ -182,7 +182,9 @@ export default class FarmItem extends cc.Component {
                     this.node_unluckBtn.active = false;
                     this.node_redPoint.active = false;
                     gData.gameData.setFarmMapRewardState(this.getIndex(), 1);
-                }        
+                }   
+                
+                gData.gameData.popTableScreenADLogic(15);
             }
         })
     }

+ 2 - 0
assets/script/game/module/moreGame/MoreGame.ts

@@ -20,6 +20,8 @@ export default class MoreGame extends cc.Component {
     start() {
         this.node.setContentSize(cc.winSize)
         gData.moreGame.init();
+
+        gData.gameData.popTableScreenADLogic(11);
     }
 
     update() {

+ 5 - 1
assets/script/game/module/newCashUI/WalletCashOut.ts

@@ -113,7 +113,11 @@ export default class WalletCashOut extends cc.Component {
         let data = gData.gameData.funOpenData;
         if(data[10] == '1')
         {
-            this.node_addCash.active = gData.gameData._cashOutTimes >= parseInt(gData.gameData.configs.ServerConfig.CashIncrease);
+            let cashTimes = gData.gameData.getProp(GameProp.cashTimes);
+            if(!cashTimes){
+                cashTimes = 0;
+            }
+            this.node_addCash.active = cashTimes >= parseInt(gData.gameData.configs.ServerConfig.CashIncrease);
         }else{
             this.node_addCash.active = false;
         }

+ 2 - 1
assets/script/game/module/newOpenRedBag/NewOpenRedBag.ts

@@ -75,7 +75,8 @@ export default class NewOpenRedBag extends cc.Component {
     }
 
     onEnable() {
-        gData.adData.checkPopInter(InterAdType.interstitial1_click_1);
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_1);
+        gData.gameData.popTableScreenADLogic(0);
 
         if (this.showNativeAd) {
             mk.ad.showNative();

+ 6 - 1
assets/script/game/module/redBagTask/RedBagTask.ts

@@ -323,7 +323,7 @@ export default class RedBagTask extends cc.Component {
             mk.data.sendXYEvent('guide_harvest', '首次领取任务红包');
         }
         gData.gameData.doPointToXYLogic();
-        gData.gameData.addCashOutTimes();
+        //gData.gameData.addCashOutTimes();
         gData.adData.checkPopCashFull();
         gData.safeDepositBoxData.updateQipao();
         gData.cashNormal.getRecord();
@@ -344,4 +344,9 @@ export default class RedBagTask extends cc.Component {
 
         mk.audio.playEffect("button");
     }
+
+    onDestroy(){
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_5);
+        gData.gameData.popTableScreenADLogic(4);
+    }
 }

+ 2 - 1
assets/script/game/module/reward/Reward.ts

@@ -45,7 +45,8 @@ export default class Reward extends cc.Component {
     }
 
     onEnable() {
-        gData.adData.checkPopInter(InterAdType.interstitial1_click_2);
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_2);
+        gData.gameData.popTableScreenADLogic(1);
 
         mk.ad.showBanner(BannerAdType.banner_click_1);
     }

+ 5 - 0
assets/script/game/module/safeDepositBox/SafeDepositBox.ts

@@ -796,4 +796,9 @@ export default class SafeDepositBox extends cc.Component {
             }
         }    
     }
+
+    onDestroy(){
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_6);
+        gData.gameData.popTableScreenADLogic(5);
+    }
 }

+ 2 - 0
assets/script/game/module/setting/Setting.ts

@@ -42,6 +42,8 @@ export default class Setting extends cc.Component {
     start() {
         //mk.ad.showNative(4);    
         this.initData();
+
+        gData.gameData.popTableScreenADLogic(10);
     }
 
     private async initData() {

+ 5 - 0
assets/script/game/module/speedUpUI/ProductReward.ts

@@ -33,6 +33,11 @@ export default class ProductReward extends cc.Component {
 
     private btnCanClick = true;
 
+    start(){
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_7);
+        gData.gameData.popTableScreenADLogic(6);
+    }
+    
     onEnable() {
 
         this.lbl_times.string = `生产次数+${gData.gameData.configs.ServerConfig.ProductionAd}`;

+ 2 - 0
assets/script/game/module/speedUpUI/RestoreProductTimes.ts

@@ -37,6 +37,8 @@ export default class RestoreProductTimes extends cc.Component {
                 gData.reward.data = rewardData;
                 gData.reward.callback = this.addDoubleTimes;
                 mk.ui.openPanel('module/reward/reward');
+
+                gData.gameData.popTableScreenADLogic(13);
             }
         })
     }

+ 6 - 0
assets/script/game/module/speedUpUI/SpeedUpUI.ts

@@ -100,6 +100,7 @@ export default class SpeedUpUI extends cc.Component {
                     }
                     gData.gameData.setHarvest();
                     mk.tip.pop('加速成功!');
+                    //gData.gameData.popTableScreenADLogic(12);
                 }
             })
         }
@@ -111,4 +112,9 @@ export default class SpeedUpUI extends cc.Component {
     private clickCloseBtn() {
         mk.audio.playEffect("button");
     }
+
+    onDestroy(){
+        //gData.adData.checkPopInter(InterAdType.interstitial1_click_9);
+        gData.gameData.popTableScreenADLogic(8);
+    }
 }

+ 2 - 1
assets/script/game/module/turntable/Turnable.ts

@@ -80,6 +80,7 @@ export default class Turnable extends cc.Component {
                 mk.console.log("watchAD:" + success);
                 if (success) {
                     gData.adData.watchVideo(AdFun.turntable);
+                    //gData.gameData.popTableScreenADLogic(14);
                 }
             });
         }
@@ -194,7 +195,7 @@ export default class Turnable extends cc.Component {
     }
 
     onDestroy() {
-
+        gData.gameData.popTableScreenADLogic(3);
     }
 
     onClickClose() {

+ 3 - 0
assets/script/mk/sdk/ad/toppon/AnyThinkAdsMgr/ATInterstitial.ts

@@ -166,6 +166,9 @@ export default class ATInterstitial extends zgSingleton {
         if (type == 0 || type == 2) {
             id = 2
             this.singleClick = true;
+            if(type == 2){
+                mk.data.sendDataEvent(DataEventId.interstita11_eject, mk.ad.interAdType);
+            }
         }
         else if (type == 1) {
             id = 9