Sfoglia il codice sorgente

卡牌升级升星资源自动刷新

zhaoyang 3 anni fa
parent
commit
f8e7848aa6

+ 13 - 5
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -88,11 +88,7 @@ namespace GFGGame
             });
 
             EventAgent.AddEventListener(ConstMessage.CARD_UP_SKILL, UpSkill);
-            EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, () =>
-            {
-                UpdateUpLvView();
-                UpdateUpStarView();
-            });
+            EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, OnItemChangeListener);
 
         }
 
@@ -666,6 +662,17 @@ namespace GFGGame
                 this.UpdateUpSkillView();
             }
         }
+        private void OnItemChangeListener()
+        {
+            CardLvlCfg cardLvCfg = CardCfgManager.GetCardLvCfgByRarityAndLv(_viewData.itemCfg.rarity, _showLv);
+            _comFosterBottom.m_listLvConsume.numItems = cardLvCfg.materiarsArr.Length;
+            if (CardDataManager.isFullStar(_viewData.id, _viewData.star, false))
+            {
+                CardStarCfg cardStarCfg = CardCfgManager.GetCardStarCfgByTypeAndRarityAndStar(_viewData.itemCfg.subType, _viewData.itemCfg.rarity, _viewData.star);
+                _comFosterBottom.m_listStarConsume.numItems = cardStarCfg.materiarsArr.Length;
+
+            }
+        }
         private void OnClickBtnBack()
         {
             ViewManager.GoBackFrom(ViewName.CARD_FOSTER_VIEW);
@@ -675,6 +682,7 @@ namespace GFGGame
         {
             base.OnHide();
             EventAgent.RemoveEventListener(ConstMessage.MONEY_CHANGE, UpdateUpStarView);
+            EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, OnItemChangeListener);
             Timers.inst.Remove(OnTimedEvent);
 
             //_timer.Stop();