wuwangdong 4 سال پیش
والد
کامیت
7acb8ae1d7

+ 8 - 2
assets/script/before/view/data/HarvestData.ts

@@ -42,8 +42,14 @@ export default class HarvestData extends Data {
             if (!isTeaching && rand <= rate) {
                 if(gData.gameData.playerProp.orderData && gData.gameData.playerProp.orderData.overTimes >0)
                 {
-                    this.isTouchBtn = false;
-                    mk.ui.openPanel('game/prefab/uiPanel/HarvestPanel');
+                    if (gData.gameData.prohibiJBAd[gData.loginData.userChannel - 1] == "1") {
+                        this.isTouchBtn = false;
+                        mk.ui.openPanel('game/prefab/uiPanel/HarvestPanel');
+                    } else {
+                        this.isCdOver = false;
+                        console.log("=========isCdOver == false");
+                        this.getNormalReward();
+                    }
                 }else{
                     this.isCdOver = false;
                     console.log("=========isCdOver == false");

+ 7 - 1
assets/script/game/data/AdData.ts

@@ -105,7 +105,7 @@ export class AdData {
     }
 
 
-    public async watchVideo(type: AdFun) {
+    public async watchVideo(type: AdFun, callBack: Function = null) {
         this.ad_subType = type;
         let data = {
             "imei": gData.appData.machineInfo.imei,
@@ -150,6 +150,11 @@ export class AdData {
         if (curData) {
             curData.setAdData(response.data);
         }
+
+        if(callBack)
+        {
+            callBack(response.data);
+        }
     }
 
     /** 更新其他广告次数
@@ -491,6 +496,7 @@ export enum AdFun {
     harvest = 9,        //收获超级加倍视频
     farmMap = 10,       //图鉴领取视频
     lineUp = 11,        //插队视频
+    addProductTimes = 12,//获得生产次数
 }
 
 export enum RateConfig {

+ 9 - 0
assets/script/game/data/GameData.ts

@@ -108,6 +108,10 @@ export class GameData {
     public maxProductToServer = false;
 
     public authUIType = 0;
+
+    public prohibiJBAd: string[] = [];
+    public prohibitProductionAd: string[] = [];
+    public productionAdMaxTimes = 20;
     /**
      * 初始化游戏数据:网络配置信息,用户信息
      * @returns 
@@ -219,6 +223,8 @@ export class GameData {
         mk.console.logSingle('userOrderTaskInfo', res_data.userOrderTaskInfo);
         this.cloneOrderData();
 
+        this.playerProp.curProductionAdTimes = res_data.dailyProductionTimes;
+
         mk.data.setTAUserID(gData.loginData.uin);
         mk.data.setTAEventUser(0, 'logindays_total', this.playerProp.loginDays);
         if (this.playerProp.completeFarmTaskTimes == 0) {
@@ -1732,6 +1738,9 @@ class PlayerProp {
 
     //插队看视频次数限制
     lineRedMoney = 0;
+
+    //当前生产次数
+    curProductionAdTimes = 0;
 }
 
 /**

+ 1 - 1
assets/script/game/data/HttpData.ts

@@ -5,7 +5,7 @@
 export class HttpData {
 
     /** 服务器类型 0测试服 1正式服 2李扬服 3悍国服 */
-    public serverType: number = 1;
+    public serverType: number = 0;
 
     public getServerUrl(): string {
         switch (this.serverType) {

+ 31 - 0
assets/script/game/data/LoginData.ts

@@ -1,3 +1,4 @@
+import JsbSystem from "../../mk/system/JsbSystem";
 import { StorageKey } from "./StorageData";
 
 /**
@@ -42,6 +43,8 @@ export class LoginData {
     public passAnti = false;
 
     public passPrivacy = false;
+    
+    public userChannel = 1;
 
     /**
      * 初始化本地配置
@@ -305,6 +308,34 @@ export class LoginData {
         gData.gameData.init();
     }
 
+    public async getUserChannel(isDoIdentify = true) {
+        let data = {};
+        let response = await mk.http.sendData('user/getUserChannel', data);
+        mk.console.logSingle('getUserChannel=>', response);
+        if (response.errcode != 0) {
+            if(isDoIdentify)
+            {
+                this.passAnti = true;
+            }     
+            return;
+        }
+
+        this.userChannel = response.data.channel;
+        if(isDoIdentify)
+        {
+            if(this.userChannel <= 5)
+            {
+                if(this.popIdentifySwitch[this.userChannel - 1] == "1")
+                {
+                    JsbSystem.ysdkInit();
+                    JsbSystem.autologin();
+                }else{
+                    this.passAnti = true;
+                }
+            }
+        }
+    }
+
     /**
      * 本地数据不是本账户的 清空数据 重新登录游戏
      */

+ 8 - 1
assets/script/game/game/Game.ts

@@ -534,7 +534,14 @@ export default class Game extends cc.Component {
             return;
         }
 
-
+        if(gData.gameData.prohibitProductionAd[gData.loginData.userChannel - 1] == "1")
+        {
+            if(gData.gameData.playerProp.curProductionAdTimes >= gData.gameData.productionAdMaxTimes)
+            {
+                mk.tip.pop('今日领取生产次数已达上限!');
+                return;
+            }
+        }
 
         let flyRed = await gData.gameData.makeProduct();
 

+ 15 - 15
assets/script/game/module/login/Login.ts

@@ -42,6 +42,8 @@ export default class Login extends cc.Component {
 
     private coreGame = null;
 
+    private hasCheckChannel = false;
+
     onLoad() {
         this.lbl_progress.node.active = false;
         this.node_load.active = true;
@@ -112,21 +114,6 @@ export default class Login extends cc.Component {
             return;
         }
 
-        if (!CC_DEBUG) {
-            if (gData.loginData.popIdentifySwitch) {
-                if (!this.hasCheckAnti) {
-                    this.hasCheckAnti = true
-                    // this.checkShowIdentification()
-                    JsbSystem.ysdkInit();
-                    JsbSystem.autologin();
-                }
-
-                if (!gData.loginData.passAnti) {
-                    return
-                }
-            }
-        }
-
         if (gData.loginData.loadResCompelete) {
             if (mk.aliRiskManager.getRiskCode) {
                 mk.aliRiskManager.getRiskCode = false;
@@ -144,6 +131,19 @@ export default class Login extends cc.Component {
                 //     this.node_btnLogin.active = true;
                 // }
 
+                if (!CC_DEBUG) {
+
+                    if(!this.hasCheckChannel)
+                    {
+                        this.hasCheckChannel = true;
+                        gData.loginData.getUserChannel();
+                    }
+                    if (!gData.loginData.passAnti) {
+                        return
+                    }
+                }
+
+
                 if (!this.loadSceneState) {
                     this.loadSceneState = true;
                     this.loadMain();

+ 12 - 1
assets/script/game/module/speedUpUI/ProductReward.ts

@@ -1,3 +1,4 @@
+import { AdFun } from "../../data/AdData";
 import { GameProp, VideoAdType } from "../../data/GameData";
 
 
@@ -130,7 +131,12 @@ export default class ProductReward extends cc.Component {
         mk.ad.videoAdType = VideoAdType.video_init_16;
         mk.ad.watchAd((success: boolean) => {
             if (success) {
-                gData.adData.watchVideo(null);
+                if(gData.gameData.prohibitProductionAd[gData.loginData.userChannel - 1] == "1")
+                {
+                    gData.adData.watchVideo(AdFun.addProductTimes, this.refreshMaxAdTimes);
+                }else{
+                    gData.adData.watchVideo(null);
+                }
 
                 let rewardData = [{ rewardType: 4, rewardNum: parseInt(gData.gameData.configs.ServerConfig.ProductionAd) }];
                 gData.reward.data = rewardData;
@@ -146,6 +152,11 @@ export default class ProductReward extends cc.Component {
         })
     }
 
+    refreshMaxAdTimes(value)
+    {
+        gData.gameData.playerProp.curProductionAdTimes = value;
+    }
+
     addTimes() {
         let add = parseInt(gData.gameData.configs.ServerConfig.ProductionAd);
         gData.gameData.changeLeftTimes(add);

+ 1 - 1
assets/script/mk/system/JsbSystem.ts

@@ -150,7 +150,7 @@ export default class JsbSystem {
             //gData.appData.appId = "wx3c0cc2f730c5ad5a";
             //gData.appData.version = "1.0.0";
             gData.appData.appId = "wxd98fe9d52af10e59";
-            gData.appData.version = "1.1.4";
+            gData.appData.version = "1.1.5";
         }
         // console.log('gData.appData  ', unicodeStr)
         // console.log('gData.appData.appId  ', gData.appData.appId)