Browse Source

Merge branch 'master' into qq

# Conflicts:
#	assets/scripts/game/Game.js
#	assets/scripts/game/GameShop.js
#	assets/scripts/lib/es6-promise.js.meta
#	assets/scripts/utils/Global.js
smallqiang 6 years ago
parent
commit
b7c1134258

+ 9 - 0
assets/scripts/common/commAlert.js

@@ -43,11 +43,20 @@ cc.Class({
         this._isBuyStar = false;
         this._isBuyStar = false;
     },
     },
 
 
+    /// 初始化上次
+    initAddDiamond(iconPath, desc, title, diamond) {
+        this.diamond = diamond;
+        this.init(iconPath, desc, title);
+    },
+
     start () {
     start () {
 
 
     },
     },
 
 
     sureAction() {
     sureAction() {
+        if (this.diamond > 0) {
+            GameModule.userInfo.diamond += this.diamond;
+        }
         GameModule.audioMng.playClickButton();
         GameModule.audioMng.playClickButton();
         let notificationStr = this._isBuyStar ? 'commAlert_BuyStar_hidden' : 'commAlert_hidden';
         let notificationStr = this._isBuyStar ? 'commAlert_BuyStar_hidden' : 'commAlert_hidden';
         GameEvent.fire(notificationStr);
         GameEvent.fire(notificationStr);

+ 6 - 0
assets/scripts/game/Game.js

@@ -208,16 +208,22 @@ cc.Class({
                             GameModule.userInfo.diamond += shopData.diamond;
                             GameModule.userInfo.diamond += shopData.diamond;
                         }
                         }
 
 
+                        //// 购买的是礼包
                         if (shopData.type == 4) {
                         if (shopData.type == 4) {
                             //// 更新购买明星数量
                             //// 更新购买明星数量
                             GameEvent.fire(GameNotificationKey.GameUpdateStarContentBuyGold);
                             GameEvent.fire(GameNotificationKey.GameUpdateStarContentBuyGold);
+                            if (shopData.starId != undefined && shopData.roomId != undefined) {
+                                GameEvent.fire(GameNotificationKey.StarEnterRoom, shopData.starId, shopData.roomId);
+                            }
                         }
                         }
                     }
                     }
                     return;
                     return;
                 }
                 }
+
                 if (TapTapTool.compare(GameGlobal._buyStarGold, GameGlobal.userData.goldObj)) {
                 if (TapTapTool.compare(GameGlobal._buyStarGold, GameGlobal.userData.goldObj)) {
                     GameGlobal._redTypes.push(GameRedDot.star);
                     GameGlobal._redTypes.push(GameRedDot.star);
                 }
                 }
+
                 //// 下面这段代码只是去重,不要重复的更新
                 //// 下面这段代码只是去重,不要重复的更新
                 let isContain = false;
                 let isContain = false;
                 for (let i = 0; i < data.type.length; ++ i) {
                 for (let i = 0; i < data.type.length; ++ i) {

+ 26 - 1
assets/scripts/game/GameShop.js

@@ -16,7 +16,27 @@ cc.Class({
 
 
     // LIFE-CYCLE CALLBACKS:
     // LIFE-CYCLE CALLBACKS:
     onLoad () {
     onLoad () {
+        this.setUpNotification();
+        this.handelUserShops();
+        GameModule.userInfo.shop = this;
+    },
 
 
+    handelUserShops() {
+        let shops = Global.shops;
+        this._mtArr = [];
+        this._useTimeArr = [];
+        this._diamondShopCoinTime = 0;
+        if (shops == undefined || shops.length == 0) {
+            return;
+        }
+        for (let i = 0; i < shops.length; ++ i) {
+            let shop = shops[i];
+            this.handelShop(shop);
+        }
+        this.updateTimeSchedule();
+    },
+    /// 设置通知
+    setUpNotification() {
         GameEvent.on('store_buy_coin_updateDiamond', this, () => {
         GameEvent.on('store_buy_coin_updateDiamond', this, () => {
             /// 说明前面没有这个商品
             /// 说明前面没有这个商品
             if (this._diamondShopCoinTime === 0) {
             if (this._diamondShopCoinTime === 0) {
@@ -76,7 +96,12 @@ cc.Class({
             if (stringArr.length > 1) {
             if (stringArr.length > 1) {
                 desc = stringArr[0] + '<br/>' + stringArr[1];
                 desc = stringArr[0] + '<br/>' + stringArr[1];
             }
             }
-            AlertManager.showCommonAlert(iconPath, desc, shop.name);
+            /// 如果是每天获取钻石的数量 那么点击确定之后才更新砖石数量
+            if (shop.shopId === 0 && shop.diamond !== undefined && shop.diamond > 0) {
+                AlertManager.showGetDiamondEveryDayAlert(iconPath, desc, shop.name, shop.diamond);
+            } else {
+                AlertManager.showCommonAlert(iconPath, desc, shop.name);
+            }
             /// 如果商品id小于等于0什么都不做
             /// 如果商品id小于等于0什么都不做
             if (shop.shopId > 0) {
             if (shop.shopId > 0) {
                 this.reportShop(shop.shopId);
                 this.reportShop(shop.shopId);

+ 11 - 0
assets/scripts/utils/AlertManager.js

@@ -217,6 +217,17 @@ class AlertManager {
         });
         });
     }
     }
 
 
+    /// 显示每天获取钻石弹窗
+    static showGetDiamondEveryDayAlert(iconPath, desc, title, diamond) {
+        DWTool.loadResPrefab("./prefabs/common/commonAlert")
+            .then((result) => {
+                let alert = cc.instantiate(result);
+                let canvas = cc.find("Canvas");
+                canvas.addChild(alert);
+                alert.getComponent('commAlert').initAddDiamond(iconPath, desc, title, diamond);
+        });
+    }
+
     /// 显示通知弹窗
     /// 显示通知弹窗
     static showNoticeAlert(noticeStr) {
     static showNoticeAlert(noticeStr) {
         DWTool.loadResPrefab("./prefabs/common/noticeAlert")
         DWTool.loadResPrefab("./prefabs/common/noticeAlert")

+ 0 - 7
taptapstarSubGame/assets/Texture.meta

@@ -1,7 +0,0 @@
-{
-  "ver": "1.0.1",
-  "uuid": "58562d79-12e5-495f-9997-5b4f2a66055a",
-  "isSubpackage": false,
-  "subpackageName": "",
-  "subMetas": {}
-}