blob: df1c0cadb24398a1046871d56983a1ada48e3e4d (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient
{
internal class XShopTabCategoryHandler : XNormalShopView
{
private XUIPool _tabItemPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private List<int> _tabs = new List<int>();
private List<IXUICheckBox> _tabCheckList = new List<IXUICheckBox>();
private int _curTabId = -1;
protected override void Init()
{
base.Init();
this.InitProperties();
}
public override void RegisterEvent()
{
base.RegisterEvent();
}
protected override void OnShow()
{
this.UpdateTabs();
this.SetDefaultTabCheck();
base.OnShow();
}
private void SetDefaultTabCheck()
{
int shopViewDefaultTab = XNormalShopDocument.ShopDoc.GetShopViewDefaultTab();
bool flag = this._tabCheckList.Count > 0;
if (flag)
{
bool flag2 = shopViewDefaultTab > 0;
if (flag2)
{
for (int i = 0; i < this._tabCheckList.Count; i++)
{
bool flag3 = (int)this._tabCheckList[i].ID == shopViewDefaultTab;
if (flag3)
{
bool bChecked = this._tabCheckList[i].bChecked;
if (bChecked)
{
this._curTabId = (int)this._tabCheckList[0].ID;
}
else
{
this._tabCheckList[i].bChecked = true;
}
break;
}
}
}
else
{
bool bChecked2 = this._tabCheckList[0].bChecked;
if (bChecked2)
{
this._curTabId = (int)this._tabCheckList[0].ID;
}
else
{
this._tabCheckList[0].bChecked = true;
}
}
}
}
protected override void OnHide()
{
base.OnHide();
}
public override void OnUnload()
{
this._tabCheckList.Clear();
this._tabs.Clear();
this._tabItemPool.ReturnAll(false);
base.OnUnload();
}
private void UpdateTabs()
{
XNormalShopDocument specificDocument = XDocuments.GetSpecificDocument<XNormalShopDocument>(XNormalShopDocument.uuID);
this._tabs = specificDocument.GetTabListOfShop(this.m_SysShop);
this._tabs.Sort();
this._tabCheckList.Clear();
this._tabItemPool.ReturnAll(false);
for (int i = 0; i < this._tabs.Count; i++)
{
GameObject item = this._tabItemPool.FetchGameObject(false);
this.InitTabItem(item, i);
}
}
private void InitTabItem(GameObject item, int tabIndex)
{
List<string> stringList = XSingleton<XGlobalConfig>.singleton.GetStringList("ShopTabTypeList");
IXUICheckBox ixuicheckBox = item.transform.Find("Bg").GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox.ForceSetFlag(false);
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnItemTypeChecked));
ixuicheckBox.ID = (ulong)((long)this._tabs[tabIndex]);
this._tabCheckList.Add(ixuicheckBox);
item.transform.localPosition = new Vector3(this._tabItemPool.TplPos.x + (float)(this._tabItemPool.TplWidth * tabIndex), this._tabItemPool.TplPos.y, this._tabItemPool.TplPos.z);
string text = (this._tabs[tabIndex] <= stringList.Count) ? stringList[this._tabs[tabIndex] - 1] : "";
IXUILabel ixuilabel = item.transform.Find("Bg/TextLabel").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(text);
IXUILabel ixuilabel2 = item.transform.Find("Bg/SelectedTextLabel").GetComponent("XUILabel") as IXUILabel;
ixuilabel2.SetText(text);
}
private bool OnItemTypeChecked(IXUICheckBox iXUICheckBox)
{
bool flag = !iXUICheckBox.bChecked;
bool result;
if (flag)
{
result = false;
}
else
{
this._curTabId = (int)iXUICheckBox.ID;
this.RefreshTabItems();
result = true;
}
return result;
}
private void RefreshTabItems()
{
base.RefreshGoodsList();
}
private void InitProperties()
{
this._tabItemPool.SetupPool(base.PanelObject, base.PanelObject.transform.Find("TabItem").gameObject, 4u, false);
}
protected override bool CheckGoodsShowing(ShopTable.RowData shopGoods)
{
bool flag = base.CheckGoodsShowing(shopGoods);
return flag && (int)shopGoods.ShopItemType == this._curTabId;
}
}
}
|