Browse Source

加速次数

kaka 4 năm trước cách đây
mục cha
commit
a6a30cff52

+ 0 - 2
assets/script/before/map/MapMove.ts

@@ -116,8 +116,6 @@ export class MapMove extends cc.Component {
     }
 
     private clickSpeedup() {
-        
-        mk.ui.openPanel('module/speedUpUI/speedUp');
         mk.data.sendDataEvent(DataEventId.button_click, "全体加速icon");
     }
 }

+ 4 - 24
assets/script/game/data/GameData.ts

@@ -85,6 +85,8 @@ export class GameData {
 
     //标志位 生产奖励的任务ui刷新
     public init_productTask = false;
+
+    public speedUpLeftTimes = 0;
     /**
      * 初始化游戏数据:网络配置信息,用户信息
      * @returns 
@@ -365,18 +367,6 @@ export class GameData {
         }
     }
 
-    /**
-     * 第二天需要重置的数据
-     */
-    public resetProps() {
-        let arr = [];
-        arr.push({ key: GameProp.sign_can, value: 1 });
-        arr.push({ key: GameProp.isAutoOpenPanel, value: 1 });
-        arr.push({ key: GameProp.isOpenBankOnCloseCash, value: 0 });
-
-        this.setProps(arr);
-    }
-
     /** 是否是新用户 */
     public isNewPlayer(): boolean {
         let v = this.getProp(GameProp.newPlayer);
@@ -1042,21 +1032,11 @@ export enum GameProp {
     //红包任务tag
     redBagTaskRefresh = 18,
 
-
+    //加速剩余次数
+    speedUpLeftTimes = 19,
 
     /** ------------------ 转盘数据 ------------------------------ */
     turnable_leftTimes = 20,
-
-    /** ------------------ 存钱罐数据 ----------------------------- */
-
-    /** ------------------ 签到数据 ----------------------------- */
-    /** 上次签到进度 */
-    sign_last_bar = 120,
-    /** 当前能否签到 */
-    sign_can = 121,
-    /** ------------------ 红包提现 ----------------------------- */
-    /** 提现进度 */
-    redBag_cash_bar = 220,
 }
 
 /**

+ 19 - 11
assets/script/game/module/speedUpUI/SpeedUpUI.ts

@@ -19,8 +19,8 @@ export default class SpeedUpUI extends cc.Component {
 
 
     start() {
-
         this.initCashOutStyle(gData.gameData.gameData.redMoney);
+        this.lbl_remainTimes.string = `今日剩余次数:${gData.gameData.speedUpLeftTimes}`;
     }
 
     onEnable() {
@@ -32,7 +32,6 @@ export default class SpeedUpUI extends cc.Component {
     }
 
     update(dt) {
-
         if (gData.reward.add_redbag_value) {
             this.initCashOutStyle(gData.gameData.gameData.redMoney + gData.reward.add_redbag_value);
         }
@@ -72,15 +71,24 @@ export default class SpeedUpUI extends cc.Component {
 
     private clickWatchVideoBtn() {
         mk.audio.playEffect("button");
-        mk.ui.closePanel(this.node.name);
-        mk.ad.videoAdType = VideoAdType.video_init_14;
-        mk.ad.watchAd((success) => {
-            if (success) {
-                gData.adData.watchVideo(null);
-                gData.gameData.setHarvest();
-                mk.tip.pop('加速成功!');
-            }
-        })
+        if (gData.gameData.speedUpLeftTimes <= 0) {
+            mk.tip.pop('今日加速次数已用完');
+            return;
+        }
+        if (gData.gameData.checkCanSpeedUp()) {
+            mk.ui.closePanel(this.node.name);
+            mk.ad.videoAdType = VideoAdType.video_init_14;
+            mk.ad.watchAd((success) => {
+                if (success) {
+                    gData.adData.watchVideo(null);
+                    gData.gameData.setHarvest();
+                    mk.tip.pop('加速成功!');
+                }
+            })
+        }
+        else {
+            mk.tip.pop('没有可加速的物品');
+        }
     }