wuwangdong hace 4 años
padre
commit
5ece47510d

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

@@ -148,6 +148,8 @@ export class FactoryIcon extends cc.Component {
             //     //mk.audio.playEffect('redmoney');
             //     gData.gameData.gameStyle.dpFlyRedAni();
             // }
+
+            
         }
         else {
             mk.tip.pop('商品已满!')

+ 57 - 49
assets/script/game/data/GameData.ts

@@ -216,6 +216,11 @@ export class GameData {
 
             //注册时版本号
             mk.data.setTAEventUserStr(0, 'regtime_app_id', gData.appData.appVersion);
+
+            //星云uid
+            mk.data.setTAEventUserStr(0, 'xy_uid', gData.loginData.uin);
+
+            mk.data.setTAEventUser(0, 'farm_lv', gData.gameData.playerProp.gradeLevel);
         }
 
         //当前版本号
@@ -290,7 +295,6 @@ export class GameData {
         this.setFramDataMapByServer();
         this.setPastureDataMapByServer();
         this.setFactoryDataMapByServer();
-        this.initSetMaxProduct();
         this.initProductTimes();
         this.initLeftTimes();
         this.initFarmMapGetRewardData();
@@ -599,7 +603,7 @@ export class GameData {
             }
 
             //第一次初始数据
-            this.setMaxProduct(ProductType.nzw, 10003);
+            // this.setMaxProduct(10003);
             //更新到服务器
             this.setProp(GameProp.farmData, this._farmData);
         }
@@ -657,6 +661,19 @@ export class GameData {
     /** 产品生产/种植次数 */
     private _productMakeTimesMap: Map<number, number> = new Map();
 
+    private initProductTimes() {
+        this._productMakeTimesData = this.getProp(GameProp.productMakeTimes);
+        if (!this._productMakeTimesData) {
+            this._productMakeTimesData = [];
+        }
+
+        let len = this._productMakeTimesData.length;
+        for (var i = 0; i < len; i++) {
+            this._productMakeTimesMap.set(this._productMakeTimesData[i].id, this._productMakeTimesData[i].times);
+            this.setMaxProduct(this._productMakeTimesData[i].id);
+        }
+    }
+
     addProductMakeTimesById(id: number) {
         let times = this._productMakeTimesMap.get(id);
         if (!times) {
@@ -694,7 +711,7 @@ export class GameData {
         if (nextConfig) {
             if (nextConfig.tab == curConfig.tab && nextID > this.getMaxProduct(curConfig.tab)) {
                 if (nextConfig.unlock == 1 && nextConfig.value <= times) {
-                    this.setMaxProduct(curConfig.tab, nextID);
+                    this.setMaxProduct(nextID);
                     let nConfig = this.getProductMap(nextID + 1);
                     if (nConfig) {
                         gData.plantData.init_lock = nextID + 1;
@@ -829,13 +846,13 @@ export class GameData {
             for (var i = 0; i < 6; i++) {
                 tab = this.getTabByConfigID(id);
                 let arr = this.getProductArrByType(tab);
-                if (this.playerProp.gradeLevel < arr[0].value) {
+                if (this.playerProp.completeFarmTaskTimes < arr[0].value) {
                     data = { id: id, state: FactroyState.Lock, productID: 0, growSpan: 0 };
                 }
                 else {
                     data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
                     //更新最大可购买商品
-                    this.setMaxProduct(tab, arr[0].picture, false);
+                    // this.setMaxProduct(arr[0].picture);
                 }
                 this._factoryData.push(data);
                 this._factoryDataMap.set(id, data);
@@ -843,7 +860,6 @@ export class GameData {
             }
 
             //更新到服务器
-            this.setProp(GameProp.maxProduct, this._maxProduct);
             this.setProp(GameProp.factoryData, this._factoryData);
         }
         else {
@@ -944,7 +960,12 @@ export class GameData {
         return null;
     }
 
-    public setMaxProduct(tab, id, sendToServer = true) {
+    /** 设置最大可生产商品
+     * @param id 产品id
+     * @param unlock 是否是解锁增加
+     */
+    public setMaxProduct(id, unlock = false) {
+        let config = this.getProductMap(id);
         if (!this._maxProduct) {
             this._maxProduct = [];
         }
@@ -953,42 +974,23 @@ export class GameData {
         let has = false;
         for (var i = 0; i < len; i++) {
             data = this._maxProduct[i];
-            if (data.tab == tab) {
-                data.productID = id;
+            if (data.tab == config.tab) {
+                if (data.productID < id) {
+                    data.productID = id;
+                }
                 has = true;
                 break;
             }
         }
 
-        if (!has) {
-            data = { tab: tab, productID: id };
+        if (!has && unlock) {
+            data = { tab: config.tab, productID: id };
             this._maxProduct.push(data);
         }
-
-        if (sendToServer) {
-            this.setProp(GameProp.maxProduct, this._maxProduct);
-        }
-    }
-
-    public initSetMaxProduct() {
-        if (this._maxProduct.length <= 0) {
-            this._maxProduct = this.getProp(GameProp.maxProduct);
-        }
-    }
-
-    private initProductTimes() {
-        this._productMakeTimesData = this.getProp(GameProp.productMakeTimes);
-        if (!this._productMakeTimesData) {
-            this._productMakeTimesData = [];
-        }
-        let len = this._productMakeTimesData.length;
-        for (var i = 0; i < len; i++) {
-            this._productMakeTimesMap.set(this._productMakeTimesData[i].id, this._productMakeTimesData[i].times);
-        }
     }
 
     /** 农场升级时解锁工厂,检查最大可种植/生产商品 */
-    public checkGradeUpUnLock() {
+    public checkTaskFinishUnLock() {
         for (var key in ProductType) {
             let tab = ProductType[key];
             let configArr = this.getProductArrByType(tab);
@@ -997,7 +999,7 @@ export class GameData {
             let needUpdate = false;
             switch (tab) {
                 case ProductType.nzw:
-                    //不做处理,游戏最开始已解锁
+                    this.setMaxProduct(10003, true);
                     break;
                 case ProductType.dw:
                     let id = 30001;
@@ -1005,19 +1007,25 @@ export class GameData {
                     let maxId = 0;
                     for (var i = 0; i < len; i++) {
                         data = this.getPastureDataMap(id);
-                        if (data.state == PastureState.Lock && this.playerProp.completeFarmTaskTimes >= configArr[i].value) {
-                            data = { id: id, state: PastureState.Empty, productID: configArr[i].picture, growSpan: 0 };
-                            this.setPastureDataMap(id, data, false);
-                            needUpdate = true;
+                        if (this.playerProp.completeFarmTaskTimes >= configArr[i].value) {
+                            if (data.state == PastureState.Lock) {
+                                data = { id: id, state: PastureState.Empty, productID: configArr[i].picture, growSpan: 0 };
+                                this.setPastureDataMap(id, data, false);
+                                needUpdate = true;
+                            }
+
                             maxId = configArr[i].picture;
                         }
                         id++;
                     }
-                    //更新到服务器
-                    if (needUpdate) {
+
+                    if (maxId != 0) {
                         //更新最大可购买商品
-                        this.setMaxProduct(ProductType.dw, maxId);
+                        this.setMaxProduct(maxId, true);
+                    }
 
+                    //更新到服务器
+                    if (needUpdate) {
                         this.setProp(GameProp.pastureData, this._pastureData);
                         this.setNextProduct();
                     }
@@ -1027,12 +1035,14 @@ export class GameData {
                     needUpdate = false;
                     let configID = this.getConfigIDByTab(tab);
                     data = this.getFactoryDataMap(configID);
-                    if (data.state == FactroyState.Lock && this.playerProp.completeFarmTaskTimes >= configArr[0].value) {
-                        data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
-                        this.setFactoryDataMap(configID, data, false);
-                        needUpdate = true;
+                    if (this.playerProp.completeFarmTaskTimes >= configArr[0].value) {
+                        if (data.state == FactroyState.Lock) {
+                            data = { id: id, state: FactroyState.Empty, productID: 0, growSpan: 0 };
+                            this.setFactoryDataMap(configID, data, false);
+                            needUpdate = true;
+                        }
                         //更新最大可购买商品
-                        this.setMaxProduct(tab, configArr[0].picture);
+                        this.setMaxProduct(configArr[0].picture, true);
                     }
 
                     if (needUpdate) {
@@ -1117,9 +1127,6 @@ export enum GameProp {
     /** 产品生产次数 */
     productMakeTimes = 12,
 
-    /** 可生产最大产品字典 */
-    maxProduct = 13,
-
     /** 养殖场数据 */
     pastureData = 14,
 
@@ -1447,6 +1454,7 @@ export enum VideoAdType {
     video_init_17 = '点击生产按钮',
     video_init_18 = '离开游戏领红包',
     video_init_19 = '定时弹出红包',
+    video_init_20 = '插队',
 }
 
 export enum InterFullAdType {

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

@@ -117,6 +117,7 @@ export class BlessingBagData extends Data {
         this.isPlayAniUpdate = false;
         this.videoRbData = response.data.userWelFareTaskInfo;
 
+        mk.data.sendDataEvent(DataEventId.fudaiFunction, `视频红包第${this.taskRbId}档提现成功`);
         mk.data.sendDataEvent(DataEventId.Sundry, '福利提现成功');
 
         gData.receiptNotice.receip_rmb = gData.blessingBag.rbNum;

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

@@ -61,7 +61,7 @@ export class GradeRewardData extends Data {
             mk.tip.pop(`获得${addExp}点等级经验`);
             if (gData.gameData.playerProp.gradeLevel < response.data.farmLevel) {
                 gData.gameData.playerProp.gradeLevel = response.data.farmLevel;
-                // gData.gameData.checkGradeUpUnLock();
+                mk.data.setTAEventUser(0, 'farm_lv', gData.gameData.playerProp.gradeLevel);
             }
             gData.gameData.playerProp.farmExpValue = response.data.userExp;
             gData.gameData.playerProp.farmGradeData = response.data.userFarmGrageRewardInfo;

+ 3 - 0
assets/script/game/data/module/WalletCashOutData.ts

@@ -4,6 +4,7 @@
  * @description 提现数据
  */
 import { Data } from "../../../mk/data/Data";
+import { DataEventId } from "../GameData";
 
 export class WalletCashOutData extends Data {
 
@@ -70,6 +71,8 @@ export class WalletCashOutData extends Data {
             gData.receiptNotice.receip_rmb = cashData[id - 1].money;
             mk.ui.openPanel('module/newNotice/newNotice');
         }
+
+        mk.data.sendDataEvent(DataEventId.Sundry, '红包币提现成功');
     }
 
 }

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

@@ -77,7 +77,7 @@ export default class Game extends cc.Component {
         this.ani_add.node.active = false;
         gData.gameData.gameStyle = this;
         this.span = gData.gameData.ProductionRecovery * 60 * 1000;
-        gData.gameData.checkGradeUpUnLock();
+        gData.gameData.checkTaskFinishUnLock();
         this.registerCallBack();
 
         console.log("===[Jsbsystem 显示开屏广告================================")

+ 8 - 9
assets/script/game/module/newNotice/LineUpUI.ts

@@ -1,3 +1,4 @@
+import { VideoAdType } from "../../data/GameData";
 
 
 const { ccclass, property } = cc._decorator;
@@ -8,23 +9,20 @@ export default class LineUpUI extends cc.Component {
     private lbl_tip: cc.Label = null;
 
 
-    start(){
+    start() {
         gData.lineUpUIData.refresh = false;
         this.lbl_tip.string = `提现排队中,你前面还有${gData.lineUpUIData.personCount}人`;
     }
 
-    update(dt)
-    {
-        if(gData.lineUpUIData.refresh)
-        {
+    update(dt) {
+        if (gData.lineUpUIData.refresh) {
             console.log('lineUp=====>', gData.lineUpUIData.personCount);
             gData.lineUpUIData.refresh = false;
             this.lbl_tip.string = `提现排队中,你前面还有${gData.lineUpUIData.personCount}人`;
         }
     }
 
-    private clickVideoBtn()
-    {
+    private clickVideoBtn() {
         mk.audio.playEffect("button");
 
         // 看广告
@@ -32,14 +30,15 @@ export default class LineUpUI extends cc.Component {
             mk.console.log("watchAD:" + success);
             if (success) {
                 mk.tip.pop('插队成功');
+                mk.ad.videoAdType = VideoAdType.video_init_20;
                 gData.adData.watchVideo(null);
                 //gData.walletCashOutData.HttpCashOut2(gData.lineUpUIData.cashId);
             }
         });
-        
+
 
     }
-    private clickCloseBtn(){
+    private clickCloseBtn() {
 
         mk.audio.playEffect("button");
     }

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

@@ -267,7 +267,7 @@ export default class RedBagTask extends cc.Component {
 
         mk.data.setTAEventUser(0, 'Cumulative_task', gData.gameData.playerProp.completeFarmTaskTimes);
         //gData.gameData.init_redBagTask = true;
-        gData.gameData.checkGradeUpUnLock();
+        gData.gameData.checkTaskFinishUnLock();
         gData.gameData.init_task = true;
 
         this.maxNum = gData.gameData.playerProp.userFarmTaskInfo.taskCount;

+ 6 - 1
assets/script/game/module/setting/Setting.ts

@@ -77,6 +77,11 @@ export default class Setting extends cc.Component {
     }
 
     clickCopy() {
+        // //test
+        // gData.gameData.playerProp.completeFarmTaskTimes++;
+        // gData.gameData.checkTaskFinishUnLock();
+        // console.log('gData.gameData.playerProp.completeFarmTaskTimes  ', gData.gameData.playerProp.completeFarmTaskTimes);
+        // return
         mk.audio.playEffect("button");
         JsbSystem.setClipboard(gData.wechatData.unionid);
         mk.tip.pop("复制成功");
@@ -85,7 +90,7 @@ export default class Setting extends cc.Component {
     async clickMusic() {
         mk.audio.playEffect("button");
         mk.audio.switchMusicFunc();
-    
+
         let music = "module/setting/texture/" + (mk.audio.getSwitchMusic() ? "on" : "off");
         this.img_music.spriteFrame = await mk.loader.load(music, cc.SpriteFrame);
     }

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

@@ -76,7 +76,7 @@ export default class JsbSystem {
     /** 获取手机授权 */
     public static checkPermission() {
         if (CC_DEBUG) {
-            gData.appData.mac = '33:16:ec:c3:d3:55,16:46:dc:dd:b7:57';
+            gData.appData.mac = '88:16:ec:c3:d3:55,88:46:dc:dd:b7:57';
             gData.appData.machineInfo.mac = gData.appData.mac;
             gData.appData.getDeviceInfoCompelete = true;
         }