| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236 | 
							- using FairyGUI;
 
- using UI.FieldGuide;
 
- using UI.CommonGame;
 
- using System.Collections.Generic;
 
- using UI.ClothingSynthetic;
 
- using UnityEngine;
 
- using System;
 
- namespace GFGGame
 
- {
 
-     public class SuitGuideListView : BaseWindow
 
-     {
 
-         private UI_SuitGuideListUI _ui;
 
-         private List<int> _suitIds;
 
-         private int _suitTypeId;
 
-         private Dictionary<int, EffectUI> _effectUIDic = new Dictionary<int, EffectUI>();
 
-         public override void Dispose()
 
-         {
 
-             foreach (var v in _effectUIDic)
 
-             {
 
-                 EffectUIPool.Recycle(v.Value);
 
-             }
 
-             _effectUIDic.Clear();
 
-             if (_ui != null)
 
-             {
 
-                 _ui.Dispose();
 
-                 _ui = null;
 
-             }
 
-             base.Dispose();
 
-         }
 
-         protected override void OnInit()
 
-         {
 
-             base.OnInit();
 
-             packageName = UI_SuitGuideListUI.PACKAGE_NAME;
 
-             _ui = UI_SuitGuideListUI.Create();
 
-             this.viewCom = _ui.target;
 
-             isfullScreen = true;
 
-             isReturnView = true;
 
-             _ui.m_loaBg.url = ResPathUtil.GetBgImgPath("tjbg");
 
-             _ui.m_listSuitCom.m_listSuit.itemRenderer = RenderListSuitItem;
 
-             _ui.m_btnBack.onClick.Add(OnClickBtnBack);
 
-             _ui.m_btnSearch.onClick.Add(OnClickBtnSearch);
 
-         }
 
-         protected override void AddEventListener()
 
-         {
 
-             base.AddEventListener();
 
-             EventAgent.AddEventListener(ConstMessage.JUMP_TO_SOURCE, this.Hide);
 
-             EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateSuitStatus);
 
-             EventAgent.AddEventListener(ConstMessage.SUIT_BOX_STATUS_CHANGED, UpdateSuitStatus);
 
-             EventAgent.AddEventListener(ConstMessage.SUIT_BOX_STATUS_CHANGED, UpdateListSuit);
 
-             EventAgent.AddEventListener(ConstMessage.DRESS_SEARCH, FilterItems);
 
-             EventAgent.AddEventListener(ConstMessage.DRESS_FILTER, FilterItems);
 
-             EventAgent.AddEventListener(ConstMessage.DRESS_FILTER_RESET, ResetFilter);
 
-         }
 
-         protected override void OnShown()
 
-         {
 
-             base.OnShown();
 
-             _suitTypeId = (int)viewData;
 
-             UpdateListSuit();
 
-             if (backRefresh)
 
-             {
 
-                 _ui.m_In.Play();
 
-             }
 
-         }
 
-         protected override void OnHide()
 
-         {
 
-             base.OnHide();
 
-             DressUpMenuItemDataManager.Clear();
 
-             // 清空服装过滤界面选择
 
-             EventAgent.DispatchEvent(ConstMessage.DRESS_FILTER_RESET_ALL);
 
-         }
 
-         protected override void RemoveEventListener()
 
-         {
 
-             base.RemoveEventListener();
 
-             EventAgent.RemoveEventListener(ConstMessage.JUMP_TO_SOURCE, this.Hide);
 
-             EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateSuitStatus);
 
-             EventAgent.RemoveEventListener(ConstMessage.SUIT_BOX_STATUS_CHANGED, UpdateSuitStatus);
 
-             EventAgent.RemoveEventListener(ConstMessage.SUIT_BOX_STATUS_CHANGED, UpdateListSuit);
 
-             EventAgent.RemoveEventListener(ConstMessage.DRESS_SEARCH, FilterItems);
 
-             EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER, FilterItems);
 
-             EventAgent.RemoveEventListener(ConstMessage.DRESS_FILTER_RESET, ResetFilter);
 
-         }
 
-         private void FilterItems(EventContext context)
 
-         {
 
-             UpdateListSuit();
 
-             
 
-             if (context.data.ToString() == ConstMessage.DRESS_SEARCH)
 
-             {
 
-                 _suitIds = DressUpMenuItemDataManager.DressSearch(_suitIds, DressFilterItemType.Suit);
 
-             }
 
-             else if (context.data.ToString() == ConstMessage.DRESS_FILTER)
 
-             {
 
-                 _suitIds = DressUpMenuItemDataManager.DressFilter(_suitIds, DressFilterItemType.Suit);
 
-             }
 
-             ViewManager.Hide<ModalStatusView>();
 
-             _ui.m_listSuitCom.m_listSuit.numItems = _suitIds.Count;
 
-             UpdateProgress();
 
-             _ui.m_Refresh.Play();
 
-         }
 
-         private void OnClickBtnBack()
 
-         {
 
-             Hide();
 
-         }
 
-         private void OnClickBtnSearch()
 
-         {
 
-             ViewManager.Show<DressFilterView>(new object[] { 0, 2 });
 
-         }
 
-         private void UpdateListSuit()
 
-         {
 
-             _suitIds = SuitUtil.GetSuitIdList(true, true, _suitTypeId, 0);
 
-             UpdateProgress();
 
-         }
 
-         private void UpdateProgress()
 
-         {
 
-             int haveCount = SuitUtil.GetHaveSuitCount(_suitIds);
 
-             int totalCount = _suitIds.Count;
 
-             SuitGuideMenuCfg cfg = SuitGuideMenuCfgArray.Instance.GetCfg(_suitTypeId);
 
-             _ui.m_title.text = cfg.name;
 
-             _ui.m_progress.target.value = haveCount;
 
-             _ui.m_progress.target.max = totalCount;
 
-             _ui.m_progress.m_title1.SetVar("value", haveCount.ToString()).SetVar("max", totalCount.ToString()).FlushVars();
 
-             if (totalCount > 0)
 
-             {
 
-                 _ui.m_progress.m_rate.SetVar("rate", FieldGuideView.ProgressCalculate(haveCount, totalCount).ToString()).FlushVars();
 
-             }
 
-             else
 
-             {
 
-                 _ui.m_progress.m_rate.SetVar("rate", "0").FlushVars();
 
-             }
 
-             foreach (var v in _effectUIDic)
 
-             {
 
-                 EffectUIPool.Recycle(v.Value);
 
-             }
 
-             _effectUIDic.Clear();
 
-             _ui.m_listSuitCom.m_listSuit.numItems = _suitIds.Count;
 
-             _ui.m_listSuitCom.m_listSuit.scrollPane.ScrollTop();
 
-             UpdateSuitStatus();
 
-         }
 
-         private void RenderListSuitItem(int index, GObject item)
 
-         {
 
-             UI_SuitComitem listItem = UI_SuitComitem.Proxy(item);
 
-             int suitId = _suitIds[index];
 
-             SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
 
-             if ((suitCfg.rarity - 1) == 4)
 
-             {
 
-                 bool haveSuit = DressUpMenuSuitDataManager.CheckHaveSuit(suitId);
 
-                 if (haveSuit && !_effectUIDic.ContainsKey(index))
 
-                 {
 
-                     _effectUIDic.Add(index, EffectUIPool.CreateEffectUI(listItem.m_holderBg, "ui_KP", "KP_Other_Gold_Frame"));
 
-                 }
 
-             }
 
-             listItem.m_txtName.text = suitCfg.name;
 
-             listItem.m_loaderPic.url = ResPathUtil.GetFieldGuideIconPath(suitCfg.res);
 
-             RarityIconController.UpdateRarityIcon(listItem.m_rarity, suitId, false, true);
 
-             listItem.target.data = suitId;
 
-             listItem.m_loaderBonusBox.target.onClick.Clear();
 
-             listItem.m_loaderBonusBox.target.onClick.Add(() =>
 
-             {
 
-                 SuitUtil.ShowSuitGuideBonus(suitId);
 
-             });
 
-             UI_SuitComitem.ProxyEnd();
 
-         }
 
-         private void UpdateSuitStatus(EventContext eventContext = null)
 
-         {
 
-             int num = _ui.m_listSuitCom.m_listSuit.numChildren;
 
-             for (int i = 0; i < num; i++)
 
-             {
 
-                 UI_CompSuitItem listItem = UI_CompSuitItem.Proxy(_ui.m_listSuitCom.m_listSuit.GetChildAt(i));
 
-                 UpdateSuitStatusView(listItem);
 
-                 UI_CompSuitItem.ProxyEnd();
 
-             }
 
-         }
 
-         private void UpdateSuitStatusView(UI_CompSuitItem listItem)
 
-         {
 
-             int suitId = (int)listItem.target.data;
 
-             int count = 0;
 
-             int totalCount = 0;
 
-             DressUpMenuSuitDataManager.GetSuitProgressBySuitId(suitId, out count, out totalCount);
 
-             listItem.m_progBar.max = totalCount;
 
-             listItem.m_progBar.value = count;
 
-             bool haveSuit = DressUpMenuSuitDataManager.CheckHaveSuit(suitId);
 
-             listItem.m_state.selectedIndex = (haveSuit ? 0 : 1);
 
-             int status = DressUpMenuSuitDataManager.GetSuitGuideBonusStatus(suitId);
 
-             RedDotController.Instance.SetComRedDot(listItem.m_loaderBonusBox.target, status == ConstBonusStatus.CAN_GET, "", -3, -1);
 
-             if (status == ConstBonusStatus.CAN_GET)
 
-             {
 
-                 listItem.m_loaderBonusBox.m_loaderBonusBox.url = "ui://FieldGuide/tujian_lw_1";
 
-             }
 
-             else
 
-             {
 
-                 listItem.m_loaderBonusBox.m_loaderBonusBox.url = "ui://FieldGuide/tujian_lw_2";
 
-             }
 
-             listItem.m_bg.onClick.Clear();
 
-             listItem.m_bg.onClick.Add(() =>
 
-             {
 
-                 if (haveSuit)
 
-                 {
 
-                     ViewManager.Show<SuitShowView>(new object[] { _suitTypeId, suitId, _suitIds }, false, false);
 
-                 }
 
-                 else
 
-                 {
 
-                     ViewManager.Show<SuitPartsDetailView>(suitId);
 
-                 }
 
-             });
 
-         }
 
-         private void ResetFilter()
 
-         {
 
-             UpdateListSuit();
 
-         }
 
-     }
 
- }
 
 
  |