kaka il y a 5 ans
Parent
commit
e43e0e0235

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

@@ -44,6 +44,8 @@ export class GameData {
         this.initProps(response.data.gameUserData);
 
         this.dataFinish = true;
+
+        gData.moreGame.init()
     }
 
     /**
@@ -103,7 +105,7 @@ export class GameData {
     }
 
     private initProps(data) {
-        if(data == null){
+        if (data == null) {
             return;
         }
         for (let key in data) {

+ 12 - 0
assets/script/game/data/MoreGameData.ts

@@ -71,6 +71,11 @@ export default class MoreGameData {
         ]
     }
 
+    /** 初始化数据 */
+    init() {
+        this.sendRecommendList();
+    }
+
     async sendRecommendList() {
         // if (this._moreGameList == null || this._moreGameList == undefined) {
         //     let data = {};
@@ -202,6 +207,13 @@ export default class MoreGameData {
         let data = this.moreGameList.normal[index]
         return data
     }
+
+    /** 弹出互推红包弹窗 */
+    popMoreGamePopNode() {
+        if (Math.random() <= gData.gameData.configs.globalCfg.popMoreGame) {
+            mk.ui.openPanel('module/moreGame/moreGamePopNode');
+        }
+    }
 }
 
 /** 下载任务 */

+ 1 - 1
assets/script/game/module/module/moreGame/MoreGame.ts

@@ -21,7 +21,7 @@ export default class MoreGameNode extends cc.Component {
 
     start() {
         this.node.setContentSize(cc.winSize)
-        gData.moreGame.sendRecommendList()
+        gData.moreGame.init_moreGameList = true;
 
         let addY = (cc.winSize.height - 1334)
         this.normalSv.node.height += addY

+ 2 - 2
assets/script/game/module/module/moreGame/MoreGameBanner.ts

@@ -34,11 +34,11 @@ export default class MoreGameBanner extends cc.Component {
 
     private startX = 0
     private coolTime = false
-    private curSelDownItem = null
+    private curSelDownItem: cc.Node = null
     private preDownItem = null
     private curIndex = 0
     private bannerDatas = null
-    private curSelPoint = null
+    private curSelPoint: cc.Node = null
 
     private hasClick = false;
 

+ 0 - 4
assets/script/game/module/module/moreGame/MoreGamePicItem.ts

@@ -27,10 +27,6 @@ export default class MoreGamePicItem extends cc.Component {
     data = null
     cool = false
 
-    start() {
-
-    }
-
     init(data) {
         this.data = data
 

+ 13 - 4
assets/script/game/module/module/moreGame/MoreGamePopNode.ts

@@ -15,14 +15,23 @@ export default class MoreGamePopNode extends cc.Component {
     data = null
 
     start() {
+        gData.moreGame.init_moreGameList = true;
+    }
 
+    update() {
+        if (gData.moreGame.init_moreGameList) {
+            this.init();
+        }
     }
 
-    init(data) {
-        this.data = data
+    lateUpdate() {
+        gData.moreGame.init_moreGameList = false;
+    }
 
+    init() {
+        this.data = gData.moreGame.getRandomNormal();
         if (this.data) {
-            cc.loader.load(data.icon, (err, res) => {
+            cc.loader.load(this.data.icon, (err, res) => {
                 if (err) {
                     console.log('err:', err);
                     return;
@@ -31,7 +40,7 @@ export default class MoreGamePopNode extends cc.Component {
                 this.icon.spriteFrame = new cc.SpriteFrame(tex);
             })
 
-            this.labName.string = data.title
+            this.labName.string = this.data.title
         }
     }