薛鸿潇 5 år sedan
förälder
incheckning
9965e9ec78
1 ändrade filer med 9 tillägg och 2 borttagningar
  1. 9 2
      assets/script/game/module/reward/Reward.ts

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

@@ -47,6 +47,8 @@ export default class Reward extends cc.Component {
     private lbl_cash: cc.Label = null;
 
 
+    /** 当前阶段 */
+    private cur_stage: number = LidType.none;
 
     onLoad() {
         this.lbl_reward_value.string = '0';
@@ -80,16 +82,17 @@ export default class Reward extends cc.Component {
             this.node_mission.active = false;
             this.btn_watch_video.node.active = false;
             this.watchVideoCall();
-            mk.audio.playEffect("rewardOpen");
         } else if (this.lid_type === LidType.luck) {
             this.node_luck.active = true;
             this.node_mission.active = false;
             this.btn_watch_video.node.active = true;
+            this.cur_stage = LidType.luck;
             mk.audio.playEffect("reward");
         } else if (this.lid_type === LidType.mission) {
             this.node_luck.active = false;
             this.node_mission.active = true;
             this.btn_watch_video.node.active = true;
+            this.cur_stage = LidType.mission;
             mk.audio.playEffect("reward");
         }
     }
@@ -128,6 +131,8 @@ export default class Reward extends cc.Component {
      */
     private watchVideoCall() {
         if (!gData.reward.data || !gData.reward.data.length) return;
+        mk.audio.playEffect("rewardOpen");
+        this.cur_stage = LidType.none;
         // 数据排序:多条奖励,只展示红包,把红包放在首位
         const r_count = gData.reward.data.length;
         if (r_count >= 2) {
@@ -202,7 +207,9 @@ export default class Reward extends cc.Component {
     }
 
     onDestroy() {
-        mk.audio.playEffect("rewardClose");
+        if (this.cur_stage === LidType.none) {
+            mk.audio.playEffect("rewardClose");
+        }
     }
 
 }