Ver Fonte

修复bug

kaka há 4 anos atrás
pai
commit
4fe6effdec

+ 1 - 1
assets/script/before/view/uiItem/PlantItem.ts

@@ -111,7 +111,7 @@ export default class PlantItem extends cc.Component {
         if (this.data.tab == ProductType.nzw) {
             gData.farmSystem.plant(this.data.picture);
             gData.gameData.nextMake = null;
-            gData.farmSystem.selectNextFarm(false);
+            gData.gameData.setNextProduct(false);
         }
         else {
             gData.factorySystem.make(this.data.picture);

+ 1 - 1
assets/script/game/component/tween/EffectOpenAndClose.ts

@@ -113,7 +113,7 @@ export default class EffectOpenAndClose extends cc.Component {
                     //let toY = this.effect_par.y + this.effect_par.height;
                     let toY = 0;
                     cc.tween(this.effect_par)
-                        .by(0.3, { y: cc.winSize.height,}, cc.easeSineOut())
+                        .by(0.15, { y: cc.winSize.height }, cc.easeOut(3))
                         .start()
                     break;
             }

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

@@ -456,9 +456,11 @@ export class GameData {
     }
 
     makeProduct() {
+        let flyRed = true;
         switch (this.nextType) {
             case 0:
                 mk.tip.pop('农场已满,无法继续生产');
+                flyRed = false;
                 break;
             case 1:
                 gData.farmSystem.btnMake();
@@ -485,6 +487,7 @@ export class GameData {
                 this.updateNewTaskProgress();
                 break;
         }
+        return flyRed;
     }
 
     private async updateNewTaskProgress() {

+ 16 - 20
assets/script/game/game/Game.ts

@@ -181,20 +181,18 @@ export default class Game extends cc.Component {
         if (gData.gameData.gameData.userFarmTaskInfo) {
             let com = gData.gameData.gameData.userFarmTaskInfo.completeCount;
             let count = gData.gameData.gameData.userFarmTaskInfo.taskCount;
-            if(gData.gameData.init_redBagTask)
-            {
+            if (gData.gameData.init_redBagTask) {
                 this.lbl_task.string = `<b><color=#8D4D32>点击领取任务!</c></b>`
                 this.node_hand.active = true;
-            }else{
+            } else {
                 this.lbl_task.string = `<b><color=#8D4D32>进行${count}次生产</c><color=#7EB80E>(${com}/${count})</color></b>`
-                if(com >= count)
-                {
+                if (com >= count) {
                     this.node_hand.active = true;
-                }else{
+                } else {
                     this.node_hand.active = false;
                 }
             }
-            
+
         }
 
     }
@@ -216,16 +214,14 @@ export default class Game extends cc.Component {
         if (gData.gameData.gameData.userFarmTaskInfo) {
             let com = gData.gameData.gameData.userFarmTaskInfo.completeCount;
             let count = gData.gameData.gameData.userFarmTaskInfo.taskCount;
-            if(gData.gameData.init_redBagTask)
-            {
+            if (gData.gameData.init_redBagTask) {
                 this.lbl_task.string = `<b><color=#8D4D32>点击领取任务!</c></b>`
                 this.node_hand.active = true;
-            }else{
+            } else {
                 this.lbl_task.string = `<b><color=#8D4D32>进行${count}次生产</c><color=#7EB80E>(${com}/${count})</color></b>`
-                if(com >= count)
-                {
+                if (com >= count) {
                     this.node_hand.active = true;
-                }else{
+                } else {
                     this.node_hand.active = false;
                 }
             }
@@ -424,17 +420,17 @@ export default class Game extends cc.Component {
             return;
         }
 
-        gData.gameData.makeProduct();
-
+        let flyRed = gData.gameData.makeProduct();
 
-        let pos = this.node_taskHb.parent.convertToWorldSpaceAR(this.node_taskHb.getPosition());
-        mk.fly.PlayCoinAnim(1, 3, this.btn_product, pos, () => {
-            gData.gameData.init_task = true;
-        }, 1)
+        if (flyRed) {
+            let pos = this.node_taskHb.parent.convertToWorldSpaceAR(this.node_taskHb.getPosition());
+            mk.fly.PlayCoinAnim(1, 3, this.btn_product, pos, () => {
+                gData.gameData.init_task = true;
+            }, 0.8);
+        }
     }
 
 
-
     public doFlyExpAni(exp: number, startPos: cc.Node, data) {
         let pos = this.lbl_farmLevel.node.parent.convertToWorldSpaceAR(this.lbl_farmLevel.node.getPosition());
         mk.fly.PlayCoinAnim(2, 3, startPos, pos, () => {

+ 28 - 10
assets/script/game/module/speedUpUI/ProductReward2.ts

@@ -1,18 +1,28 @@
 import Util from "../../../before/util/Util";
 import JsbSystem from "../../../mk/system/JsbSystem";
+import { AdFun } from "../../data/AdData";
+import { VideoAdType } from "../../data/GameData";
 
 const { ccclass, property } = cc._decorator;
 
 @ccclass
 export default class ProductReward2 extends cc.Component {
 
-    @property({displayName: '数字组', type: cc.Label})
+    @property({ displayName: '数字组', type: cc.Label })
     private lbl_value: cc.Label[] = [];
 
-    start(){
-
+    start() {
         this.showChangePart();
+    }
 
+    update() {
+        if (gData.harvestData.init_reward) {
+            gData.harvestData.init_reward = false;
+
+            //奖励弹窗
+            gData.reward.adData = gData.harvestData.adData;
+            mk.ui.openPanel('module/reward/reward');
+        }
     }
 
     showChangePart() {
@@ -26,18 +36,26 @@ export default class ProductReward2 extends cc.Component {
         }, 0.1)
     }
 
-    private clickVideoBtn()
-    {
+    private async clickVideoBtn() {
         mk.audio.playEffect("button");
+        mk.ui.closePanel(this.node.name);
+        // mk.ad.destroyNativeAd();
+        await mk.time.WaitForSeconds(0.3);
+        // 看广告
+        mk.ad.videoAdType = VideoAdType.video_init_12;
+        mk.ad.watchAd(async (success: boolean) => {
+            mk.console.log("watchAD:" + success);
+            if (success) {
+                await gData.adData.watchVideo(AdFun.harvest);
+            }
+        });
     }
 
-    private clickCloseBtn()
-    {
-        mk.audio.playEffect("closeButton"); 
+    private clickCloseBtn() {
+        mk.audio.playEffect("closeButton");
     }
 
-    private clickExitBtn()
-    {
+    private clickExitBtn() {
         JsbSystem.systemExit();
     }
 }