Browse Source

月卡奖励

zhaoyang 2 years ago
parent
commit
9a5f6f67e8

+ 4 - 5
GameClient/Assets/Game/HotUpdate/Controller/BonusController.cs

@@ -12,6 +12,7 @@ namespace GFGGame
             {
                 List<ItemData> bonusList = ItemUtil.CreateItemDataList(bonusInfos);
                 CheckUpdateAutoUseItem(bonusList);
+                if (bonusList.Count == 0) return;
                 ViewManager.Show<RewardView>(new object[] { bonusList, onSuccess });
             }
         }
@@ -20,6 +21,7 @@ namespace GFGGame
             if (bonusList != null && bonusList.Count > 0)
             {
                 CheckUpdateAutoUseItem(bonusList);
+                if (bonusList.Count == 0) return;
                 ViewManager.Show<RewardView>(new object[] { bonusList, onSuccess });
             }
         }
@@ -35,11 +37,8 @@ namespace GFGGame
                 if (itemCfg != null && itemCfg.itemType == ConstItemType.USEABLE &&
                     (itemCfg.subType == ConstItemSubType.USEABLE_AUTO))
                 {
-                    if(itemCfg.itemsArr != null && itemCfg.itemsArr.Length > 0)
-                    {
-                        itemDatasFromAutoUsedItem.AddRange(ItemUtil.CreateItemDataList(itemCfg.itemsArr, t.num));
-                        bonusList.RemoveAt(i);
-                    }
+                    itemDatasFromAutoUsedItem.AddRange(ItemUtil.CreateItemDataList(itemCfg.itemsArr, t.num));
+                    bonusList.RemoveAt(i);
                 }
             }
             bonusList.AddRange(itemDatasFromAutoUsedItem);

+ 19 - 4
GameClient/Assets/Game/HotUpdate/Views/Store/StoreMonthView.cs

@@ -136,10 +136,10 @@ namespace GFGGame
             _ui.m_txtTime.visible = endTime > TimeHelper.ServerNow();
             _ui.m_loaCard.url = iconUrl;
             ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(monthCfg.shopId);
-            if(shopCfg.onceShopId > 0)
+            if (shopCfg.onceShopId > 0)
             {
                 //如果配置了首次购买物品,使用特殊id购买
-                if(ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.onceShopId) <= 0)
+                if (ShopDataManager.Instance.GetGoodsBuyNumById(shopCfg.onceShopId) <= 0)
                 {
                     shopCfg = ShopCfgArray.Instance.GetCfg(shopCfg.onceShopId);
                 }
@@ -160,11 +160,26 @@ namespace GFGGame
             _ui.m_btnGet.text = isGot ? "已领取" : "领取";
             _ui.m_btnGet.data = monthCfg.type; ;
         }
-        private void OnBtnBuyCardClick(EventContext context)
+        private async void OnBtnBuyCardClick(EventContext context)
         {
             GObject obj = context.sender as GObject;
             int goodsId = (int)obj.data;
-            ShopSProxy.ReqShopBuy(goodsId).Coroutine();
+            bool result = await ShopSProxy.ReqShopBuy(goodsId);
+            if (result)
+            {
+                MonthlyCardPrivilegeCfg privilegeCfg = MonthlyCardPrivilegeCfgArray.Instance.GetCfg(MonthCardPrivilegeType.Privilege1);
+                int[][] itemData = null;
+
+                if (menu2 == ConstStoreSubId.STORE_MONTH_GOLD_CARD)
+                {
+                    itemData = new int[][] { new int[] { privilegeCfg.paramsArr[0], privilegeCfg.value1Arr[0] } };
+                }
+                else if (menu2 == ConstStoreSubId.STORE_MONTH_GOLD_CARD)
+                {
+                    itemData = new int[][] { new int[] { privilegeCfg.paramsArr[0], privilegeCfg.value2Arr[0] } };
+                }
+                BonusController.TryShowBonusList(itemData);
+            }
         }
         private async void OnBtnGetClick(EventContext context)
         {