瀏覽代碼

卡牌优化

zhaoyang 3 年之前
父節點
當前提交
3be58935b9

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

@@ -41,10 +41,10 @@ namespace GFGGame
             _ui.m_listRole.onClickItem.Add(OnClickListRoleItem);
             _ui.m_listRole.selectedIndex = 0;
 
-            EventAgent.AddEventListener(ConstMessage.CARD_REFRESH, () =>
-            {
-                UpdateCardList(_ui.m_listRole.selectedIndex);
-            });
+            // EventAgent.AddEventListener(ConstMessage.CARD_REFRESH, () =>
+            // {
+            //     UpdateCardList(_ui.m_listRole.selectedIndex);
+            // });
         }
 
         protected override void OnShown()
@@ -88,7 +88,7 @@ namespace GFGGame
 
             UI_ComStar comStar = UI_ComStar.Proxy(listItem.m_comStar);
             comStar.m_c1.selectedIndex = data.star;
-
+            UI_ComStar.ProxyEnd();
             UI_ListCardItem.ProxyEnd();
         }
         private void OnClickListCardItem(EventContext context)

+ 17 - 8
GameClient/Assets/Game/HotUpdate/Views/Card/CardFosterView.cs

@@ -96,18 +96,18 @@ namespace GFGGame
 
             //_ui.m_btnUpSkill.onClick.Add(OnClickBtnUpSkill);
 
-            EventAgent.AddEventListener(ConstMessage.PLAT_CARDFOSTER_T1, () =>
-            {
-                _ui.m_t1.Play();
-            });
+            // EventAgent.AddEventListener(ConstMessage.PLAT_CARDFOSTER_T1, () =>
+            // {
+            //     _ui.m_t1.Play();
+            // });
 
-            EventAgent.AddEventListener(ConstMessage.CARD_UP_SKILL, UpdateUpSkillView);
         }
 
 
         protected override void OnShown()
         {
             base.OnShown();
+            // AddEventListener();
             // _comLvConsumeGold = UI_ComCostCurrency.Proxy(_comFosterBottom.m_ComLvConsumeGold);
             //_comStarCousumeGold = UI_ComCostCurrencyWithHas.Proxy(_comFosterBottom.m_comStarCousumeGold);
 
@@ -127,6 +127,11 @@ namespace GFGGame
             this.UpdateUpStarView();
             this.UpdateUpSkillView();
             _comFosterBottom.m_ctrlTab.selectedIndex = this._selectTab;
+
+        }
+        protected override void AddEventListener()
+        {
+            EventAgent.AddEventListener(ConstMessage.CARD_UP_SKILL, UpdateUpSkillView);
             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateItemChange);
 
         }
@@ -810,15 +815,19 @@ namespace GFGGame
         protected override void OnHide()
         {
             base.OnHide();
-            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateUpStarView);
-            EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, OnItemChangeListener);
-            EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateItemChange);
+
 
             Timers.inst.Remove(OnTimedEvent);
             UI_ComCostCurrency.ProxyEnd();
             UI_ComCostCurrencyWithHas.ProxyEnd();
             _comFosterBottom.m_listLvConsume.numItems = 0;
         }
+        protected override void RemoveEventListener()
+        {
+            EventAgent.RemoveEventListener(ConstMessage.NUMERIC_CHANGE, UpdateUpStarView);
+            EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, OnItemChangeListener);
+            EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateItemChange);
+        }
         protected override void UpdateToCheckGuide(object param)
         {
             if (!ViewManager.CheckIsTopView(this.viewCom)) return;

+ 15 - 3
GameClient/Assets/Game/HotUpdate/Views/Card/CardSkillView.cs

@@ -30,11 +30,14 @@ namespace GFGGame
 
             _ui.m_btnUpLv.onClick.Add(OnClickBtnUp);
             _ui.m_listConsume.itemRenderer = RenderListStarConsumeItem;
+
+
+        }
+        protected override void AddEventListener()
+        {
             EventAgent.AddEventListener(ConstMessage.CARD_UP_SKILL, UpdateView);
             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateView);
-
         }
-
         protected override void OnShown()
         {
             base.OnShown();
@@ -112,12 +115,16 @@ namespace GFGGame
                 //材料不足显示加号
                 listItem.m_btnPlus.visible = true;
             }
+            UI_ComStarConsume.ProxyEnd();
         }
         private void OnClickBtnPlusStarConsum(int index)
         {
-            int itemId = int.Parse(UI_ComStarConsume.Proxy(_ui.m_listConsume.GetChildAt(index)).target.data.ToString());
+            UI_ComStarConsume comStarConsume = UI_ComStarConsume.Proxy(_ui.m_listConsume.GetChildAt(index));
+            int itemId = int.Parse(comStarConsume.target.data.ToString());
+            UI_ComStarConsume.ProxyEnd();
             CardData cardData = CardDataManager.GetCardDataById(_cardId);
             ViewManager.Show(ViewName.APPROACH_OF_ITEM_VIEW, new object[] { itemId, new object[] { ViewName.CARD_FOSTER_VIEW, cardData } });
+
         }
         private async void OnClickBtnUp()
         {
@@ -152,5 +159,10 @@ namespace GFGGame
         {
             base.OnHide();
         }
+        protected override void RemoveEventListener()
+        {
+            EventAgent.RemoveEventListener(ConstMessage.CARD_UP_SKILL, UpdateView);
+            EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateView);
+        }
     }
 }

+ 1 - 0
GameClient/Assets/Game/HotUpdate/Views/Card/CardStoryView.cs

@@ -54,6 +54,7 @@ namespace GFGGame
                 listItem.m_c1.selectedIndex = 1;
                 listItem.m_txtDescribe.text = string.Format("词牌等级达到{0}级解锁", cardStoryCfg.lvl); ; ;// "词牌等级达到" + cardStoryCfg.lvl + "级解锁";
             }
+            UI_ListCardStoryItem.ProxyEnd();
         }
         private void OnClickBtnGo(CardStoryCfg cardStoryCfg)
         {

+ 1 - 1
GameClient/Assets/Game/HotUpdate/Views/Card/CardUpView.cs

@@ -65,7 +65,7 @@ namespace GFGGame
 
             listItem.m_txtProperty.text = _scores[index + 1].ToString();
             listItem.m_loaIcon.url = ResPathUtil.GetCommonGameResPath("kp_sx_" + (index + 1));
-
+            UI_ListPropertyItem.ProxyEnd();
         }
         //private void OnClickBtnBack()
         //{

+ 12 - 0
GameClient/Assets/Game/HotUpdate/Views/UIView.cs

@@ -123,6 +123,9 @@ namespace GFGGame
             {
                 MakeFullScreen(viewCom);
             }
+
+            AddEventListener();
+
             if (GuideController.IsGuide())
             {
                 // UpdateToCheckGuide(null);
@@ -134,9 +137,18 @@ namespace GFGGame
         {
             viewData = null;
 
+            RemoveEventListener();
             Timers.inst.Remove(UpdateToCheckGuide);
             TryCompleteGuide();
         }
+        virtual protected void RemoveEventListener()
+        {
+
+        }
+        virtual protected void AddEventListener()
+        {
+
+        }
         virtual protected void UpdateToCheckGuide(object param)
         {