|
@@ -18,7 +18,9 @@ namespace GFGGame
|
|
{
|
|
{
|
|
private UI_CardFilterUI _ui;
|
|
private UI_CardFilterUI _ui;
|
|
|
|
|
|
- private SortedList[] _dataList = { ConstCardSubType.CardSubTypeList(), ConstDressUpScoreType.scoreTypeList(), ConstCardState.CardStateList() };
|
|
|
|
|
|
+ private SortedList _list0Datas = ConstCardSubType.CardSubTypeList();
|
|
|
|
+ private SortedList _list1RarityDatas = ConstDressRarity.DressRarityList();
|
|
|
|
+ private SortedList _list2Datas = ConstCardState.CardStateList();
|
|
public override void Dispose()
|
|
public override void Dispose()
|
|
{
|
|
{
|
|
if (_ui != null)
|
|
if (_ui != null)
|
|
@@ -39,89 +41,148 @@ namespace GFGGame
|
|
viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
viewAnimationType = EnumViewAnimationType.ZOOM_CENTER;
|
|
|
|
|
|
_ui.m_btnGo.onClick.Add(OnClickBtnGo);
|
|
_ui.m_btnGo.onClick.Add(OnClickBtnGo);
|
|
- _ui.m_btnChoose.onClick.Add(UpdateList);
|
|
|
|
|
|
+ // _ui._selectRoleList.onClick.Add(UpdateList);
|
|
|
|
|
|
- _ui.m_list0.itemRenderer = RenderListItem;
|
|
|
|
- _ui.m_list0.onClickItem.Add(OnClickListItem);
|
|
|
|
|
|
+ _ui.m_list0.itemRenderer = RenderListRoleItem;
|
|
|
|
+ _ui.m_list0.onClickItem.Add(OnClickListRoleItem);
|
|
_ui.m_list0.data = EnumCardFilterType.SubType;
|
|
_ui.m_list0.data = EnumCardFilterType.SubType;
|
|
|
|
|
|
- _ui.m_list1.itemRenderer = RenderListItem;
|
|
|
|
- _ui.m_list1.onClickItem.Add(OnClickListItem);
|
|
|
|
|
|
+ _ui.m_list1.itemRenderer = RenderListRarityItem;
|
|
|
|
+ _ui.m_list1.onClickItem.Add(OnClickListRarityItem);
|
|
_ui.m_list1.data = EnumCardFilterType.PROPERTY;
|
|
_ui.m_list1.data = EnumCardFilterType.PROPERTY;
|
|
|
|
|
|
- _ui.m_list2.itemRenderer = RenderListItem;
|
|
|
|
- _ui.m_list2.onClickItem.Add(OnClickListItem);
|
|
|
|
|
|
+ _ui.m_list2.itemRenderer = RenderListFosterItem;
|
|
|
|
+ _ui.m_list2.onClickItem.Add(OnClickListRarityItem);
|
|
_ui.m_list2.data = EnumCardFilterType.FOSTER;
|
|
_ui.m_list2.data = EnumCardFilterType.FOSTER;
|
|
|
|
|
|
|
|
+ _ui.m_btnChoose.onClick.Add(UpdateSelectAll);
|
|
}
|
|
}
|
|
|
|
|
|
protected override void OnShown()
|
|
protected override void OnShown()
|
|
{
|
|
{
|
|
base.OnShown();
|
|
base.OnShown();
|
|
- _ui.m_btnChoose.selected = false;
|
|
|
|
- CardDataManager._selectList.Clear();
|
|
|
|
- this.UpdateList();
|
|
|
|
|
|
|
|
|
|
+ this.UpdateList();
|
|
|
|
+ if (!CardDataManager.isFilter)
|
|
|
|
+ {
|
|
|
|
+ _ui.m_btnChoose.selected = true;
|
|
|
|
+ UpdateSelectAll();
|
|
|
|
+ }
|
|
|
|
+ CardDataManager.isFilter = true;
|
|
}
|
|
}
|
|
private void UpdateList()
|
|
private void UpdateList()
|
|
{
|
|
{
|
|
_ui.m_list0.numItems = ConstCardSubType.CardSubTypeList().Count;
|
|
_ui.m_list0.numItems = ConstCardSubType.CardSubTypeList().Count;
|
|
- _ui.m_list1.numItems = ConstDressUpScoreType.scoreTypeList().Count;
|
|
|
|
|
|
+ _ui.m_list1.numItems = ConstDressRarity.DressRarityList().Count;
|
|
_ui.m_list2.numItems = ConstCardState.CardStateList().Count;
|
|
_ui.m_list2.numItems = ConstCardState.CardStateList().Count;
|
|
}
|
|
}
|
|
- /// <summary>
|
|
|
|
- ///
|
|
|
|
- /// </summary>
|
|
|
|
- /// <param name="filterType">筛选大类型:人物,属性,培养度</param>
|
|
|
|
- /// <param name="value">筛选小类型:天地玄黄,宫商角徵羽,满级满星满技能升级升星升技能</param>
|
|
|
|
- /// <param name="select">是否筛选</param>
|
|
|
|
- private void UpdateSelectList(int filterType, int value, bool select)
|
|
|
|
|
|
+ private void UpdateSelectAll()
|
|
{
|
|
{
|
|
- Dictionary<int, int> typeDic;
|
|
|
|
- if (CardDataManager._selectList.ContainsKey(filterType) == false)
|
|
|
|
|
|
+ CardDataManager._selectRoleList.Clear();
|
|
|
|
+ CardDataManager._selectRarityList.Clear();
|
|
|
|
+ CardDataManager._selectFosterList.Clear();
|
|
|
|
+ if (_ui.m_btnChoose.selected)
|
|
{
|
|
{
|
|
- typeDic = new Dictionary<int, int>();
|
|
|
|
- CardDataManager._selectList.Add(filterType, typeDic);
|
|
|
|
|
|
+ for (int i = 0; i < ConstCardSubType.CardSubTypeList().Keys.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ CardDataManager._selectRoleList.Add((int)ConstCardSubType.CardSubTypeList().GetKey(i));
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < ConstDressRarity.DressRarityList().Keys.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ CardDataManager._selectRarityList.Add((int)ConstDressRarity.DressRarityList().GetKey(i));
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < ConstCardState.CardStateList().Keys.Count; i++)
|
|
|
|
+ {
|
|
|
|
+ CardDataManager._selectFosterList.Add((int)ConstCardState.CardStateList().GetKey(i));
|
|
|
|
+ }
|
|
}
|
|
}
|
|
- typeDic = CardDataManager._selectList[filterType];
|
|
|
|
- if (select == true && typeDic.ContainsKey(value) == false)
|
|
|
|
|
|
+
|
|
|
|
+ UpdateList();
|
|
|
|
+ }
|
|
|
|
+ private void RenderListRoleItem(int index, GObject item)
|
|
|
|
+ {
|
|
|
|
+ GButton btn = item as GButton;
|
|
|
|
+ int key = index + 1;
|
|
|
|
+ btn.title = _list0Datas[key].ToString();
|
|
|
|
+ btn.data = key;
|
|
|
|
+
|
|
|
|
+ btn.selected = CardDataManager._selectRoleList.IndexOf(key) >= 0 || _ui.m_btnChoose.selected;
|
|
|
|
+ }
|
|
|
|
+ private void RenderListRarityItem(int index, GObject item)
|
|
|
|
+ {
|
|
|
|
+ GButton btn = item as GButton;
|
|
|
|
+ int key = index + 1;
|
|
|
|
+ btn.title = _list1RarityDatas[key].ToString();
|
|
|
|
+ btn.data = key;
|
|
|
|
+ btn.selected = CardDataManager._selectRarityList.IndexOf(key) >= 0 || _ui.m_btnChoose.selected;
|
|
|
|
+ }
|
|
|
|
+ private void RenderListFosterItem(int index, GObject item)
|
|
|
|
+ {
|
|
|
|
+ GButton btn = item as GButton;
|
|
|
|
+ int key = index + 1;
|
|
|
|
+ btn.title = _list2Datas[key].ToString();
|
|
|
|
+ btn.data = key;
|
|
|
|
+ btn.selected = CardDataManager._selectFosterList.IndexOf(key) >= 0 || _ui.m_btnChoose.selected;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ private void OnClickListRoleItem(EventContext context)
|
|
|
|
+ {
|
|
|
|
+ GButton btn = context.data as GButton;
|
|
|
|
+ int key = (int)btn.data;
|
|
|
|
+ int index = CardDataManager._selectRoleList.IndexOf(key);
|
|
|
|
+ if (index < 0)
|
|
{
|
|
{
|
|
- typeDic.Add(value, value);
|
|
|
|
|
|
+ btn.selected = true;
|
|
|
|
+ CardDataManager._selectRoleList.Add(key);
|
|
}
|
|
}
|
|
- else if (select == false && typeDic.ContainsKey(value) == true)
|
|
|
|
|
|
+ else
|
|
{
|
|
{
|
|
- typeDic.Remove(value);
|
|
|
|
|
|
+ _ui.m_btnChoose.selected = false;
|
|
|
|
+ btn.selected = false;
|
|
|
|
+ CardDataManager._selectRoleList.Remove(key);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
- private void RenderListItem(int index, GObject item)
|
|
|
|
|
|
+ private void OnClickListRarityItem(EventContext context)
|
|
{
|
|
{
|
|
- GButton btn = item as GButton;
|
|
|
|
- string name = this._dataList[(int)btn.parent.data][index + 1].ToString();
|
|
|
|
- btn.title = name;
|
|
|
|
- btn.data = index + 1;
|
|
|
|
- if (_ui.m_btnChoose.selected == true)
|
|
|
|
|
|
+ GButton btn = context.data as GButton;
|
|
|
|
+ int key = (int)btn.data;
|
|
|
|
+ int index = CardDataManager._selectRarityList.IndexOf(key);
|
|
|
|
+ if (index < 0)
|
|
{
|
|
{
|
|
btn.selected = true;
|
|
btn.selected = true;
|
|
|
|
+ CardDataManager._selectRarityList.Add(key);
|
|
}
|
|
}
|
|
else
|
|
else
|
|
{
|
|
{
|
|
|
|
+ _ui.m_btnChoose.selected = false;
|
|
btn.selected = false;
|
|
btn.selected = false;
|
|
|
|
+ CardDataManager._selectRarityList.Remove(key);
|
|
}
|
|
}
|
|
- this.UpdateSelectList((int)btn.parent.data, index + 1, btn.selected);
|
|
|
|
}
|
|
}
|
|
-
|
|
|
|
- private void OnClickListItem(EventContext context)
|
|
|
|
|
|
+ private void OnClickListFosterItem(EventContext context)
|
|
{
|
|
{
|
|
GButton btn = context.data as GButton;
|
|
GButton btn = context.data as GButton;
|
|
- this.UpdateSelectList((int)btn.parent.data, (int)btn.data, btn.selected);
|
|
|
|
- if (_ui.m_btnChoose.selected == true && btn.selected == false)
|
|
|
|
|
|
+ int key = (int)btn.data;
|
|
|
|
+ int index = CardDataManager._selectFosterList.IndexOf(key);
|
|
|
|
+ if (index < 0)
|
|
|
|
+ {
|
|
|
|
+ btn.selected = true;
|
|
|
|
+ CardDataManager._selectFosterList.Add(key);
|
|
|
|
+ }
|
|
|
|
+ else
|
|
{
|
|
{
|
|
_ui.m_btnChoose.selected = false;
|
|
_ui.m_btnChoose.selected = false;
|
|
|
|
+ btn.selected = false;
|
|
|
|
+ CardDataManager._selectFosterList.Remove(key);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+
|
|
|
|
+
|
|
private void OnClickBtnGo()
|
|
private void OnClickBtnGo()
|
|
{
|
|
{
|
|
- ViewManager.GoBackFrom(ViewName.CARD_FILTER_VIEW);
|
|
|
|
|
|
+ // ViewManager.GoBackFrom(ViewName.CARD_FILTER_VIEW);
|
|
|
|
+ EventAgent.DispatchEvent(ConstMessage.CARD_FILTER);
|
|
|
|
+ this.Hide();
|
|
}
|
|
}
|
|
protected override void OnHide()
|
|
protected override void OnHide()
|
|
{
|
|
{
|