Quellcode durchsuchen

月卡商店刷新

zhaoyang vor 2 Jahren
Ursprung
Commit
9698f5cff5

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Data/ShopDataManager.cs

@@ -16,7 +16,7 @@ namespace GFGGame
             _goodsDic.Clear();
         }
 
-        public void UpdateGiftData(int giftId, int num)
+        public void UpdateGoodsData(int giftId, int num)
         {
             if (!_goodsDic.ContainsKey(giftId))
             {

+ 3 - 3
GameClient/Assets/Game/HotUpdate/ServerProxy/ShopSProxy.cs

@@ -15,7 +15,7 @@ namespace GFGGame
                 {
                     for (int i = 0; i < response.ks.Count; i++)
                     {
-                        ShopDataManager.Instance.UpdateGiftData(response.ks[i], response.vs[i]);
+                        ShopDataManager.Instance.UpdateGoodsData(response.ks[i], response.vs[i]);
                     }
                     return true;
                 }
@@ -30,7 +30,7 @@ namespace GFGGame
             {
                 if (response.Error == ErrorCode.ERR_Success)
                 {
-                    ShopDataManager.Instance.UpdateGiftData(response.BuyId, response.TotalTimes);
+                    ShopDataManager.Instance.UpdateGoodsData(response.BuyId, response.TotalTimes);
                     ShopCfg shopCfg = ShopCfgArray.Instance.GetCfg(response.BuyId);
                     ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(shopCfg.itemId);
                     if (LauncherConfig.netType == LauncherConfig.EnumNetType.LOCAL && shopCfg.costType == CostType.RMB)
@@ -48,7 +48,7 @@ namespace GFGGame
                     {
                         itemDatas = ItemUtil.CreateItemDataList(itemCfg.id, response.Times * shopCfg.itemNum);
                     }
-                    
+
                     EventAgent.DispatchEvent(ConstMessage.CONTINUOUS_REBATE_GIFT_SHOP_BUY, shopCfg);
                     BonusController.TryShowBonusList(itemDatas);
                     EventAgent.DispatchEvent(ConstMessage.SHOP_BUY);

+ 9 - 5
GameClient/Assets/Game/HotUpdate/Views/Store/StoreMonthView.cs

@@ -47,7 +47,7 @@ namespace GFGGame
         protected override void AddEventListener()
         {
             base.AddEventListener();
-            EventAgent.AddEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);
+            EventAgent.AddEventListener(ConstMessage.SHOP_BUY, UpdateView);
 
         }
         protected override void OnShown()
@@ -67,7 +67,7 @@ namespace GFGGame
         protected override void RemoveEventListener()
         {
             base.RemoveEventListener();
-            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.SHOP_BUY, UpdateView);
         }
         private void OnBtnBlackRewardClick()
         {
@@ -173,15 +173,19 @@ namespace GFGGame
             ShopViewManager.Instance.UptadeItem(obj, shopCfg);
         }
 
-        private void OnClickBtnBuy(EventContext context)
+        private async void OnClickBtnBuy(EventContext context)
         {
             GObject obj = context.sender as GObject;
             int index = (int)obj.data;
             ShopCfg itemData = _shopCfgs[index];
             if (!AntiAddictionController.CheckAntiAddictionRecharge(itemData.price))
             {
-                ShopSProxy.ReqShopBuy(itemData.id, 1).Coroutine();
-                LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
+                bool result = await ShopSProxy.ReqShopBuy(itemData.id, 1);
+                if (result)
+                {
+                    UpdateView();
+                    LogServerHelper.SendPlayParticipationLog((int)PlayParticipationEnum.SHANG_CHENG, 2);
+                }
             }
         }
     }