guodong 2 år sedan
förälder
incheckning
95cb3bddba
1 ändrade filer med 9 tillägg och 4 borttagningar
  1. 9 4
      GameClient/Assets/Game/HotUpdate/Views/Card/CardStoryView.cs

+ 9 - 4
GameClient/Assets/Game/HotUpdate/Views/Card/CardStoryView.cs

@@ -41,17 +41,17 @@ namespace GFGGame
         }
         private void RenderListCardStoryItem(int index, GObject obj)
         {
-            CardStoryCfg cardStoryCfg = CardDataManager.GetStoryCfgsById(_viewData.itemCfg.id)[index];
             UI_ListCardStoryItem listItem = UI_ListCardStoryItem.Proxy(obj);
+            CardStoryCfg cardStoryCfg = CardDataManager.GetStoryCfgsById(_viewData.itemCfg.id)[index];
             listItem.m_txtTitle.text = string.Format("第{0}节", NumberUtil.GetChiniseNumberText(index + 1));// "第" + NumberUtil.GetChiniseNumberText(index + 1) + "节";
             if (_viewData.lv >= cardStoryCfg.lvl)
             {
                 listItem.m_c1.selectedIndex = 0;
                 if (listItem.target.data == null)
                 {
-                    listItem.m_btnGo.onClick.Add(() => OnClickBtnGo(cardStoryCfg));
-                    listItem.target.data = cardStoryCfg.cardId;
+                    listItem.m_btnGo.onClick.Add(OnClickBtnGo);
                 }
+                listItem.m_btnGo.data = cardStoryCfg;
             }
             else
             {
@@ -61,8 +61,13 @@ namespace GFGGame
             }
             UI_ListCardStoryItem.ProxyEnd();
         }
-        private void OnClickBtnGo(CardStoryCfg cardStoryCfg)
+        private void OnClickBtnGo(EventContext context)
         {
+            var cardStoryCfg = ((GButton)context.sender).data as CardStoryCfg;
+            if(cardStoryCfg == null)
+            {
+                return;
+            }
             StoryController.ShowCardStoryDialog(cardStoryCfg, _viewData);
         }
         private void OnClickBtnMood()