浏览代码

商城道具兑换购买完成刷新后点击同一位置道具显示已售罄

zhaoyang 3 年之前
父节点
当前提交
b69ec7ad4c
共有 1 个文件被更改,包括 24 次插入11 次删除
  1. 24 11
      GameClient/Assets/Game/HotUpdate/Views/RechargeStore/RechargeStoreView.cs

+ 24 - 11
GameClient/Assets/Game/HotUpdate/Views/RechargeStore/RechargeStoreView.cs

@@ -235,19 +235,20 @@ namespace GFGGame
             item.m_c1.selectedIndex = isSellOut ? 1 : 0;
             if (item.target.data == null)
             {
-                item.target.onClick.Add(() =>
-                {
-                    bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
-                    if (isSellOut)
-                    {
-                        PromptController.Instance.ShowFloatTextPrompt("已售罄");
-                        return;
-                    }
-                    ViewManager.Show<ItemExchangeView>(cfg.id);
-                });
+                // item.target.onClick.Add(() =>
+                // {
+                //     bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
+                //     if (isSellOut)
+                //     {
+                //         PromptController.Instance.ShowFloatTextPrompt("已售罄");
+                //         return;
+                //     }
+                //     ViewManager.Show<ItemExchangeView>(cfg.id);
+                // });
+                item.target.onClick.Add(OnBtnBugItem);
             }
             ItemCfg itemCfg = ItemCfgArray.Instance.GetCfg(cfg.itemId);
-            item.target.data = cfg.id;
+            item.target.data = cfg;
             item.m_btnBuy.m_loaIcon.url = ResPathUtil.GetCommonGameResPath(ItemCfgArray.Instance.GetCfg(cfg.costId).res);
             item.m_txtName.text = itemCfg.name;
             item.m_txtDesc.text = string.Format("剩余:{0}", cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id));
@@ -257,5 +258,17 @@ namespace GFGGame
 
             UI_StoreListItem.ProxyEnd();
         }
+        private void OnBtnBugItem(EventContext context)
+        {
+            ShopExchangeCfg cfg = (context.sender as GObject).data as ShopExchangeCfg;
+            bool isSellOut = cfg.maxLimit > 0 && cfg.maxLimit - RechargeDataManager.Instance.GetExchangeBuyNumById(cfg.id) <= 0;
+            if (isSellOut)
+            {
+                PromptController.Instance.ShowFloatTextPrompt("已售罄");
+                return;
+            }
+            ViewManager.Show<ItemExchangeView>(cfg.id);
+        }
+
     }
 }