Explorar o código

【新增】当日视频次数上限后观看广告后所有界面自动关闭

zouyong %!s(int64=5) %!d(string=hai) anos
pai
achega
1cb8c6906d

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

@@ -48,7 +48,8 @@ export class AdData {
         this.watchNumToday++;
         this.watchNumToday++;
         let max = parseInt(gData.gameData.configs.ServerConfig.VideoTimesMax);
         let max = parseInt(gData.gameData.configs.ServerConfig.VideoTimesMax);
         if(this.watchNumToday > max){
         if(this.watchNumToday > max){
-            mk.tip.pop("今日看广告获得奖励的次数已用完");
+            mk.tip.pop("今日看广告获得奖励的次数已用完",1);
+            mk.ui.closeAllUI();
             return true;
             return true;
         }
         }
         else{
         else{

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

@@ -187,7 +187,7 @@ export default class Game extends cc.Component {
         gData.gameData.init_red_point = false;
         gData.gameData.init_red_point = false;
 
 
         if (this.nodeRedPoint.node_redbagCash.active) {
         if (this.nodeRedPoint.node_redbagCash.active) {
-            mk.ui.closeAllUI(["game","guide"])
+            mk.ui.closeAllUI();
             mk.guide.open(2);
             mk.guide.open(2);
         }
         }
     }
     }

+ 7 - 1
assets/script/mk/system/TipSystem.ts

@@ -36,8 +36,9 @@ export default class TipSystem extends cc.Component {
     /**
     /**
      * 弹出tips
      * 弹出tips
      * @param str 
      * @param str 
+     * @param type 弹窗类型 0正常中间弹 1弹到最顶上
      */
      */
-    public async pop(str: string) {
+    public async pop(str: string,type:number=0) {
         let node = await mk.pool.getPrefab("game/prefab/tips");
         let node = await mk.pool.getPrefab("game/prefab/tips");
         let node_bg = node.getChildByName("bg");
         let node_bg = node.getChildByName("bg");
         let node_lbl = node.getChildByName("lbl");
         let node_lbl = node.getChildByName("lbl");
@@ -53,6 +54,11 @@ export default class TipSystem extends cc.Component {
         node.parent = this.node;
         node.parent = this.node;
         node.x = this.src_x;
         node.x = this.src_x;
         node.y = this.src_y;
         node.y = this.src_y;
+        if(type == 1){
+            this.tween_time = 2;
+            node.y = 400;
+            this.tar_y = 800;
+        }
         cc.tween(node)
         cc.tween(node)
             .to(this.tween_time, { x: this.tar_x, y: this.tar_y })
             .to(this.tween_time, { x: this.tar_x, y: this.tar_y })
             .call(() => {
             .call(() => {

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

@@ -141,7 +141,7 @@ export default class UISystem extends cc.Component {
      * 关闭所有界面,除了主界面
      * 关闭所有界面,除了主界面
      * @param except 排除的ui
      * @param except 排除的ui
      */
      */
-    closeAllUI(except: string[] = null) {
+    closeAllUI(except: string[] = ["game","guide"]) {
         for (let panelName in this.curOnPanelDic) {
         for (let panelName in this.curOnPanelDic) {
             if (except && except.length > 0 && except.indexOf(panelName) != -1) {
             if (except && except.length > 0 && except.indexOf(panelName) != -1) {
                 continue;
                 continue;