|
@@ -1,3 +1,4 @@
|
|
|
+using System.Collections.Generic;
|
|
|
using FairyGUI;
|
|
|
using UI.ClothingFoster;
|
|
|
namespace GFGGame
|
|
@@ -5,6 +6,10 @@ namespace GFGGame
|
|
|
public class SuitListView : BaseWindow
|
|
|
{
|
|
|
private UI_SuitListUI _ui;
|
|
|
+ private ValueBarController _valueBarController;
|
|
|
+ private int _menuType = ConstSuitGuideTypeId.TYPE_1;
|
|
|
+ private int[] _menuTypeDataArray;
|
|
|
+ private List<int> _suitIds;
|
|
|
|
|
|
public override void Dispose()
|
|
|
{
|
|
@@ -20,22 +25,40 @@ namespace GFGGame
|
|
|
_ui = UI_SuitListUI.Create();
|
|
|
this.viewCom = _ui.target;
|
|
|
this.viewCom.Center();
|
|
|
+ isfullScreen = true;
|
|
|
+
|
|
|
// this.modal = true;
|
|
|
// viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
|
|
|
+
|
|
|
+ _valueBarController = new ValueBarController(_ui.m_valueBar);
|
|
|
+
|
|
|
+ _ui.m_listSuit.itemRenderer = ListSuitItemRenderer;
|
|
|
+ _ui.m_comBoxSort.items = new string[] { "默认排序", "稀有度高", "稀有度低", "收集度高", "收集度低" };
|
|
|
+
|
|
|
+
|
|
|
_ui.m_btnBack.onClick.Add(OnClickBtnBack);
|
|
|
+ _ui.m_comBoxSort.onChanged.Add(OnComboBoxSortChanged);
|
|
|
+ _ui.m_btnHaveGot.onChanged.Add(OnClickBtnHaveGot);
|
|
|
+ _ui.m_btnNotGet.onChanged.Add(OnClickBtnNotGet);
|
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
|
{
|
|
|
base.OnShown();
|
|
|
+ _valueBarController.OnShown();
|
|
|
+ _ui.m_btnHaveGot.selected = true;
|
|
|
+ _ui.m_btnNotGet.selected = true;
|
|
|
|
|
|
+ UpdateListSuit();
|
|
|
+ EventAgent.AddEventListener(ConstMessage.ITEM_CHANGED, UpdateSuitStatus);
|
|
|
}
|
|
|
|
|
|
protected override void OnHide()
|
|
|
{
|
|
|
base.OnHide();
|
|
|
-
|
|
|
+ _valueBarController.OnHide();
|
|
|
+ EventAgent.RemoveEventListener(ConstMessage.ITEM_CHANGED, UpdateSuitStatus);
|
|
|
}
|
|
|
|
|
|
private void OnClickBtnBack()
|
|
@@ -43,5 +66,94 @@ namespace GFGGame
|
|
|
// this.Hide();
|
|
|
ViewManager.GoBackFrom(typeof(SuitListView).FullName);
|
|
|
}
|
|
|
+ private void OnClickListTypeItem()
|
|
|
+ {
|
|
|
+ UpdateListSuit();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnComboBoxSortChanged()
|
|
|
+ {
|
|
|
+ UpdateListSuit();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnSwitch()
|
|
|
+ {
|
|
|
+ _menuType = 3 - _menuType;
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnHaveGot()
|
|
|
+ {
|
|
|
+ if (!_ui.m_btnHaveGot.selected)
|
|
|
+ {
|
|
|
+ _ui.m_btnNotGet.selected = true;
|
|
|
+ }
|
|
|
+ UpdateListSuit();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void OnClickBtnNotGet()
|
|
|
+ {
|
|
|
+ if (!_ui.m_btnNotGet.selected)
|
|
|
+ {
|
|
|
+ _ui.m_btnHaveGot.selected = true;
|
|
|
+ }
|
|
|
+ UpdateListSuit();
|
|
|
+ }
|
|
|
+ private void UpdateListSuit()
|
|
|
+ {
|
|
|
+ _ui.m_listSuit.RemoveChildrenToPool();
|
|
|
+ _suitIds = SuitUtil.GetClothingFosterSuitIdList(_ui.m_btnNotGet.selected, _ui.m_btnHaveGot.selected, _ui.m_comBoxSort.selectedIndex);
|
|
|
+ _ui.m_listSuit.numItems = _suitIds.Count;
|
|
|
+ _ui.m_listSuit.scrollPane.ScrollTop();
|
|
|
+ }
|
|
|
+
|
|
|
+ private void ListSuitItemRenderer(int index, GObject item)
|
|
|
+ {
|
|
|
+ UI_ListSuitItem listItem = UI_ListSuitItem.Proxy(item);
|
|
|
+ int suitId = _suitIds[index];
|
|
|
+ SuitCfg suitCfg = SuitCfgArray.Instance.GetCfg(suitId);
|
|
|
+ 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;
|
|
|
+ UpdateSuitStatusView(listItem);
|
|
|
+
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateSuitStatus(EventContext eventContext)
|
|
|
+ {
|
|
|
+ int num = _ui.m_listSuit.numChildren;
|
|
|
+ for (int i = 0; i < num; i++)
|
|
|
+ {
|
|
|
+ UI_ListSuitItem listItem = UI_ListSuitItem.Proxy(_ui.m_listSuit.GetChildAt(i));
|
|
|
+ UpdateSuitStatusView(listItem);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private void UpdateSuitStatusView(UI_ListSuitItem 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_imgLock.visible = listItem.m_imgLockBg.visible = !haveSuit;
|
|
|
+
|
|
|
+ listItem.m_bg.onClick.Clear();
|
|
|
+ listItem.m_bg.onClick.Add(() =>
|
|
|
+ {
|
|
|
+ if (haveSuit)
|
|
|
+ {
|
|
|
+ ViewManager.Show<SuitView>(new object[] { suitId, _suitIds }, new object[] { typeof(SuitListView).Name, this.viewData });
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ ViewManager.Show(ViewName.SUIT_PARTS_DETAIL_VIEW, suitId, new object[] { ViewName.SUIT_PARTS_DETAIL_VIEW, this.viewData });
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
}
|
|
|
-}
|
|
|
+}
|
|
|
+
|