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
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient.Utility
{
internal class XUITabControl
{
private XUIPool tab_pool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
protected float m_DisableAlpha;
private Dictionary<int, XUITabControl.UITabControlCallback> m_TabFrames = new Dictionary<int, XUITabControl.UITabControlCallback>();
public delegate void UITabControlCallback(ulong id);
public IXUICheckBox GetByCheckBoxId(ulong id)
{
List<GameObject> list = ListPool<GameObject>.Get();
this.tab_pool.GetActiveList(list);
IXUICheckBox ixuicheckBox = null;
for (int i = 0; i < list.Count; i++)
{
IXUICheckBox ixuicheckBox2 = list[i].transform.Find("Bg").GetComponent("XUICheckBox") as IXUICheckBox;
bool flag = ixuicheckBox2.ID == id;
if (flag)
{
ixuicheckBox = ixuicheckBox2;
break;
}
}
ListPool<GameObject>.Release(list);
bool flag2 = ixuicheckBox == null;
if (flag2)
{
XSingleton<XDebug>.singleton.AddErrorLog("Have not this CheckBox of id.", null, null, null, null, null);
}
return ixuicheckBox;
}
public void SetTabTpl(Transform tpl)
{
this.tab_pool.SetupPool(tpl.parent.gameObject, tpl.gameObject, 5u, false);
}
public static XSysDefine GetTargetSys(XSysDefine sys, out List<XSysDefine> subSys)
{
XSysDefine parentSys = XSingleton<XGameSysMgr>.singleton.GetParentSys(sys);
subSys = XSingleton<XGameSysMgr>.singleton.GetChildSys(parentSys);
XSysDefine xsysDefine = sys;
bool flag = sys == parentSys;
if (flag)
{
for (int i = 0; i < subSys.Count; i++)
{
bool flag2 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(subSys[i], XSingleton<XAttributeMgr>.singleton.XPlayerData);
if (!flag2)
{
bool flag3 = xsysDefine == parentSys;
if (flag3)
{
xsysDefine = subSys[i];
}
bool sysRedPointState = XSingleton<XGameSysMgr>.singleton.GetSysRedPointState(subSys[i]);
if (sysRedPointState)
{
xsysDefine = subSys[i];
break;
}
}
}
}
return xsysDefine;
}
public IXUICheckBox[] SetupTabs(XSysDefine sys, XUITabControl.UITabControlCallback func, bool bHorizontal = false, float fDisable = 1f)
{
this.tab_pool.ReturnAll(false);
this.m_TabFrames.Clear();
XPlayerAttributes xplayerData = XSingleton<XAttributeMgr>.singleton.XPlayerData;
XSysDefine parentSys = XSingleton<XGameSysMgr>.singleton.GetParentSys(sys);
List<XSysDefine> childSys = XSingleton<XGameSysMgr>.singleton.GetChildSys(parentSys);
Vector3 localPosition = this.tab_pool._tpl.transform.localPosition;
float num = (float)this.tab_pool.TplWidth;
float num2 = (float)this.tab_pool.TplHeight;
IXUICheckBox[] array = new IXUICheckBox[childSys.Count];
IXUICheckBox ixuicheckBox = null;
XSysDefine xsysDefine = sys;
bool flag = sys == parentSys;
if (flag)
{
for (int i = 0; i < childSys.Count; i++)
{
bool flag2 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(childSys[i], xplayerData);
if (!flag2)
{
bool flag3 = xsysDefine == parentSys;
if (flag3)
{
xsysDefine = childSys[i];
}
bool sysRedPointState = XSingleton<XGameSysMgr>.singleton.GetSysRedPointState(childSys[i]);
if (sysRedPointState)
{
xsysDefine = childSys[i];
break;
}
}
}
}
int j = 0;
int num3 = 0;
while (j < childSys.Count)
{
bool flag4 = !XSingleton<XGameSysMgr>.singleton.IsSystemOpened(childSys[j], xplayerData);
if (!flag4)
{
GameObject gameObject = this.tab_pool.FetchGameObject(false);
gameObject.name = childSys[j].ToString();
if (bHorizontal)
{
gameObject.transform.localPosition = localPosition + new Vector3(num * (float)num3, 0f, 0f);
}
else
{
gameObject.transform.localPosition = localPosition + new Vector3(0f, -num2 * (float)num3, 0f);
}
num3++;
IXUICheckBox ixuicheckBox2 = gameObject.transform.Find("Bg").GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox2.ID = (ulong)((long)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(childSys[j]));
ixuicheckBox2.ForceSetFlag(false);
ixuicheckBox2.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnTabControlStateChange));
array[j] = ixuicheckBox2;
this.m_TabFrames.Add((int)ixuicheckBox2.ID, func);
Transform transform = gameObject.transform.Find("Bg/TextLabel");
bool flag5 = transform != null;
if (flag5)
{
IXUILabel ixuilabel = transform.GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject.transform.Find("Bg/SelectedTextLabel").GetComponent("XUILabel") as IXUILabel;
string @string = XStringDefineProxy.GetString(childSys[j].ToString());
ixuilabel.SetText(@string);
ixuilabel2.SetText(@string);
}
else
{
IXUISprite ixuisprite = gameObject.transform.Find("Bg/Text").GetComponent("XUISprite") as IXUISprite;
IXUISprite ixuisprite2 = gameObject.transform.Find("Bg/SelectedText").GetComponent("XUISprite") as IXUISprite;
string string2 = XStringDefineProxy.GetString(childSys[j].ToString());
ixuisprite.SetSprite(string2 + "0");
ixuisprite2.SetSprite(string2 + "1");
ixuisprite.MakePixelPerfect();
ixuisprite2.MakePixelPerfect();
}
bool flag6 = childSys[j] == xsysDefine;
if (flag6)
{
ixuicheckBox = ixuicheckBox2;
}
}
j++;
}
bool flag7 = ixuicheckBox != null;
if (flag7)
{
ixuicheckBox.bChecked = true;
}
this.m_DisableAlpha = fDisable;
return array;
}
public IXUICheckBox[] SetupTabs(List<int> ids, List<string> prefix, XUITabControl.UITabControlCallback func, bool bHorizontal = false, float fDisable = 1f, int select = -1, bool bFromStringTable = true)
{
this.tab_pool.ReturnAll(false);
this.m_TabFrames.Clear();
Vector3 localPosition = this.tab_pool._tpl.transform.localPosition;
float num = (float)this.tab_pool.TplWidth;
float num2 = (float)this.tab_pool.TplHeight;
IXUICheckBox[] array = new IXUICheckBox[ids.Count];
IXUICheckBox ixuicheckBox = null;
bool flag = select == -1;
if (flag)
{
select = 0;
}
else
{
select = ids.IndexOf(select);
}
bool flag2 = select == -1;
if (flag2)
{
select = 0;
}
for (int i = 0; i < ids.Count; i++)
{
GameObject gameObject = this.tab_pool.FetchGameObject(false);
gameObject.name = ids[i].ToString();
if (bHorizontal)
{
gameObject.transform.localPosition = localPosition + new Vector3(num * (float)i, 0f, 0f);
}
else
{
gameObject.transform.localPosition = localPosition + new Vector3(0f, -num2 * (float)i, 0f);
}
IXUICheckBox ixuicheckBox2 = gameObject.transform.Find("Bg").GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox2.ID = (ulong)((long)ids[i]);
ixuicheckBox2.ForceSetFlag(false);
ixuicheckBox2.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnTabControlStateChange));
array[i] = ixuicheckBox2;
this.m_TabFrames.Add((int)ixuicheckBox2.ID, func);
Transform transform = gameObject.transform.Find("Bg/TextLabel");
bool flag3 = transform != null;
if (flag3)
{
IXUILabel ixuilabel = transform.GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject.transform.Find("Bg/SelectedTextLabel").GetComponent("XUILabel") as IXUILabel;
string text = bFromStringTable ? XStringDefineProxy.GetString(prefix[i]) : prefix[i];
ixuilabel.SetText(text);
ixuilabel2.SetText(text);
}
else
{
IXUISprite ixuisprite = gameObject.transform.Find("Bg/Text").GetComponent("XUISprite") as IXUISprite;
IXUISprite ixuisprite2 = gameObject.transform.Find("Bg/SelectedText").GetComponent("XUISprite") as IXUISprite;
ixuisprite.SetSprite(prefix[i] + "0");
ixuisprite2.SetSprite(prefix[i] + "1");
ixuisprite.MakePixelPerfect();
ixuisprite2.MakePixelPerfect();
}
bool flag4 = i == select;
if (flag4)
{
ixuicheckBox = ixuicheckBox2;
}
}
bool flag5 = ixuicheckBox != null;
if (flag5)
{
ixuicheckBox.bChecked = true;
}
this.m_DisableAlpha = fDisable;
return array;
}
public void RegistrerNewTab(ulong id, XUITabControl.UITabControlCallback func)
{
List<GameObject> list = ListPool<GameObject>.Get();
this.tab_pool.GetActiveList(list);
for (int i = 0; i < list.Count; i++)
{
IXUICheckBox ixuicheckBox = list[i].transform.Find("Bg").GetComponent("XUICheckBox") as IXUICheckBox;
bool flag = ixuicheckBox.ID == id;
if (flag)
{
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnTabControlStateChange));
this.m_TabFrames.Add((int)id, func);
}
}
ListPool<GameObject>.Release(list);
}
public bool OnTabControlStateChange(IXUICheckBox chkBox)
{
bool bChecked = chkBox.bChecked;
if (bChecked)
{
int key = (int)chkBox.ID;
XUITabControl.UITabControlCallback uitabControlCallback = this.m_TabFrames[key];
bool flag = uitabControlCallback != null;
if (flag)
{
uitabControlCallback(chkBox.ID);
}
chkBox.SetAlpha(1f);
}
else
{
chkBox.SetAlpha(this.m_DisableAlpha);
}
return true;
}
}
}
|