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
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class ArtifactAtlasHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "ItemNew/ArtifactAtlasDlg";
}
}
private readonly int m_itemCount = 4;
private uint m_selectArtifactId = 0u;
private IXUIButton m_closedBtn;
private ArtifactAtlasDocument m_doc;
private IXUITable m_itemTypeTable;
private IXUICheckBox m_curItemType2nd;
private IXUIScrollView m_itemTypeScrollView;
private XUIPool m_itemType1stPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XUIPool m_itemType2ndPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private IXUILabel m_suitNameLab;
private IXUILabel m_effectTittleLab;
private IXUILabel m_effectDesLab;
private GameObject[] m_suitItemsGo;
private Transform m_suitPanelTra;
private XUIPool m_suitAttrPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
protected override void Init()
{
base.Init();
this.m_doc = ArtifactAtlasDocument.Doc;
this.m_closedBtn = (base.PanelObject.transform.Find("Bg/Close").GetComponent("XUIButton") as IXUIButton);
this.InitTypeList();
this.InitSuit();
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_closedBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClosed));
}
protected override void OnShow()
{
base.OnShow();
this.ShowItemType();
}
protected override void OnHide()
{
base.OnHide();
bool flag = this.m_itemType1stPool != null;
if (flag)
{
this.m_itemType1stPool.ReturnAll(false);
}
bool flag2 = this.m_itemType2ndPool != null;
if (flag2)
{
this.m_itemType2ndPool.ReturnAll(false);
}
}
public override void StackRefresh()
{
base.StackRefresh();
}
public override void OnUnload()
{
base.OnUnload();
}
private void InitTypeList()
{
Transform transform = base.PanelObject.transform.Find("Bg/TypeList");
this.m_itemTypeScrollView = (transform.GetComponent("XUIScrollView") as IXUIScrollView);
transform = transform.Find("Table");
this.m_itemTypeTable = (transform.GetComponent("XUITable") as IXUITable);
transform = base.PanelObject.transform.Find("Bg/TypeList/Table/LevelOneTpl");
this.m_itemType1stPool.SetupPool(transform.parent.gameObject, transform.gameObject, 3u, false);
transform = base.PanelObject.transform.Find("Bg/TypeList/Table/LevelTwoTpl");
this.m_itemType2ndPool.SetupPool(transform.parent.gameObject, transform.gameObject, 5u, false);
}
private void InitSuit()
{
Transform transform = base.PanelObject.transform.Find("Bg/Bg/p");
this.m_suitItemsGo = new GameObject[this.m_itemCount];
Transform transform2;
for (int i = 0; i < this.m_itemCount; i++)
{
transform2 = transform.Find("item" + i.ToString());
bool flag = transform2 == null;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("item" + i.ToString() + "is null", null, null, null, null, null);
}
else
{
this.m_suitItemsGo[i] = transform2.gameObject;
IXUISprite ixuisprite = transform2.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnSelectItem));
}
}
transform = base.PanelObject.transform.Find("Bg/Bg/EffectFrame");
this.m_effectTittleLab = (transform.Find("Title").GetComponent("XUILabel") as IXUILabel);
this.m_effectDesLab = (transform.Find("Panel/Text").GetComponent("XUILabel") as IXUILabel);
transform = base.PanelObject.transform.Find("Bg/Bg/SuitFrame");
this.m_suitNameLab = (transform.Find("Title").GetComponent("XUILabel") as IXUILabel);
this.m_suitPanelTra = transform.Find("Panel");
transform2 = transform.Find("Attr");
this.m_suitAttrPool.SetupPool(transform2.parent.gameObject, transform2.gameObject, 3u, true);
this.m_suitNameLab = (base.PanelObject.transform.Find("Bg/Bg/SuitName").GetComponent("XUILabel") as IXUILabel);
}
private void ShowItemType()
{
List<ArtifactSuitLevel> levelSuitList = this.m_doc.GetLevelSuitList();
this.m_itemType1stPool.ReturnAll(true);
this.m_itemType2ndPool.ReturnAll(true);
for (int i = 0; i < levelSuitList.Count; i++)
{
ArtifactSuitLevel artifactSuitLevel = levelSuitList[i];
bool flag = artifactSuitLevel == null;
if (!flag)
{
GameObject gameObject = this.m_itemType1stPool.FetchGameObject(false);
gameObject.name = artifactSuitLevel.SuitLevel.ToString();
IXUISprite ixuisprite = gameObject.transform.Find("Switch").GetComponent("XUISprite") as IXUISprite;
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickItemType1st));
Transform transform = gameObject.transform.Find("ChildList");
bool flag2 = (artifactSuitLevel.IsDefultSelect && transform.localScale.y == 0f) || (!artifactSuitLevel.IsDefultSelect && transform.localScale.y != 0f);
if (flag2)
{
ixuisprite.SetSprite("l_add_01");
IXUITweenTool ixuitweenTool = ixuisprite.gameObject.GetComponent("XUIPlayTween") as IXUITweenTool;
ixuitweenTool.PlayTween(true, -1f);
}
IXUILabel ixuilabel = gameObject.transform.Find("SelectLab").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("ArtifactLevel"), artifactSuitLevel.SuitLevel));
ixuilabel.gameObject.SetActive(artifactSuitLevel.IsDefultSelect);
ixuilabel = (gameObject.transform.Find("UnSelectLab").GetComponent("XUILabel") as IXUILabel);
ixuilabel.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("ArtifactLevel"), artifactSuitLevel.SuitLevel));
ixuilabel.gameObject.SetActive(!artifactSuitLevel.IsDefultSelect);
int num = 0;
foreach (uint num2 in artifactSuitLevel.SuitIdList)
{
ArtifactSuit suitBySuitId = ArtifactDocument.SuitMgr.GetSuitBySuitId(num2);
bool flag3 = suitBySuitId == null || suitBySuitId.EffectsNum == 0;
if (!flag3)
{
GameObject gameObject2 = this.m_itemType2ndPool.FetchGameObject(false);
gameObject2.name = num2.ToString();
IXUICheckBox ixuicheckBox = gameObject2.GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox.ID = (ulong)num2;
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnClickItemType2nd));
gameObject2.transform.parent = transform;
gameObject2.transform.localScale = Vector3.one;
gameObject2.transform.localPosition = new Vector3(0f, -((float)transform.childCount - 0.5f) * (float)ixuicheckBox.spriteHeight, 0f);
IXUILabel ixuilabel2 = gameObject2.transform.Find("SelectLab").GetComponent("XUILabel") as IXUILabel;
ixuilabel2.SetText(suitBySuitId.Name);
IXUILabel ixuilabel3 = gameObject2.transform.Find("UnSelectLab").GetComponent("XUILabel") as IXUILabel;
ixuilabel3.SetText(suitBySuitId.Name);
bool flag4 = num == artifactSuitLevel.DefultNum && artifactSuitLevel.IsDefultSelect;
if (flag4)
{
this.m_curItemType2nd = ixuicheckBox;
ixuicheckBox.ForceSetFlag(true);
this.RefreshItemList();
ixuilabel2.gameObject.SetActive(true);
ixuilabel3.gameObject.SetActive(false);
Transform parent = ixuicheckBox.gameObject.transform.parent.parent;
parent.Find("UnSelectLab").gameObject.SetActive(false);
parent.Find("SelectLab").gameObject.SetActive(true);
IXUISprite ixuisprite2 = parent.GetComponent("XUISprite") as IXUISprite;
ixuisprite2.SetSprite("l_button_06");
}
else
{
ixuicheckBox.ForceSetFlag(false);
ixuilabel2.gameObject.SetActive(false);
ixuilabel3.gameObject.SetActive(true);
}
num++;
}
}
}
}
this.m_itemTypeTable.RePositionNow();
this.m_itemTypeTable.Reposition();
}
private void FillSuitContent(uint suitId)
{
ArtifactSuit suitBySuitId = ArtifactDocument.SuitMgr.GetSuitBySuitId(suitId);
bool flag = suitBySuitId == null;
if (!flag)
{
this.m_suitNameLab.SetText(suitBySuitId.Name);
int num = 0;
foreach (uint num2 in suitBySuitId.Artifacts)
{
bool flag2 = num >= suitBySuitId.Artifacts.Count;
if (flag2)
{
break;
}
GameObject gameObject = this.m_suitItemsGo[num];
bool flag3 = gameObject == null;
if (!flag3)
{
gameObject.SetActive(true);
ItemList.RowData itemConf = XBagDocument.GetItemConf((int)num2);
bool flag4 = itemConf == null;
if (flag4)
{
return;
}
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(gameObject, itemConf.ItemID, 0, false);
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)num2;
bool flag5 = num == 0;
if (flag5)
{
this.OnSelectItem(ixuisprite);
}
num++;
}
}
for (int i = 0; i < this.m_itemCount; i++)
{
bool flag6 = i >= suitBySuitId.Artifacts.Count;
if (flag6)
{
GameObject gameObject = this.m_suitItemsGo[i];
bool flag7 = gameObject != null;
if (flag7)
{
gameObject.SetActive(false);
}
}
}
this.FillSuitDes(suitId);
}
}
private void FillEffectDes(uint artifactId)
{
ArtifactListTable.RowData artifactListRowData = ArtifactDocument.GetArtifactListRowData(artifactId);
bool flag = artifactListRowData == null;
if (!flag)
{
this.m_effectTittleLab.SetText(string.Format(XSingleton<XStringTable>.singleton.GetString("ArtifactSkillEffect"), artifactListRowData.EffectNum));
this.m_effectDesLab.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(artifactListRowData.EffectDes));
}
}
private void FillSuitDes(uint suitId)
{
this.m_suitAttrPool.ReturnAll(true);
ArtifactSuit suitBySuitId = ArtifactDocument.SuitMgr.GetSuitBySuitId(suitId);
bool flag = suitBySuitId == null;
if (!flag)
{
int num = 0;
for (int i = 0; i < suitBySuitId.effects.Length; i++)
{
SeqListRef<uint> seqListRef = suitBySuitId.effects[i];
bool flag2 = seqListRef.Count == 0;
if (!flag2)
{
for (int j = 0; j < seqListRef.Count; j++)
{
bool flag3 = seqListRef[j, 0] == 0u;
if (!flag3)
{
GameObject gameObject = this.m_suitAttrPool.FetchGameObject(false);
gameObject.transform.parent = this.m_suitPanelTra;
gameObject.transform.localScale = Vector3.one;
gameObject.transform.localPosition = new Vector3(0f, (float)(-(float)this.m_suitAttrPool.TplHeight * num), 0f);
IXUILabel ixuilabel = gameObject.transform.Find("Text").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(string.Format("[FFFFFF]{0}[-]", XStringDefineProxy.GetString("EQUIP_SUIT_EFFECT", new object[]
{
i
})));
ixuilabel = (gameObject.transform.Find("Value").GetComponent("XUILabel") as IXUILabel);
string text = string.Format("{0}{1}", XStringDefineProxy.GetString((XAttributeDefine)seqListRef[j, 0]), XAttributeCommon.GetAttrValueStr((int)seqListRef[j, 0], (float)seqListRef[j, 1]));
ixuilabel.SetText(text);
num++;
}
}
}
}
}
}
private void RefreshItemList()
{
bool flag = !base.IsVisible();
if (!flag)
{
bool flag2 = this.m_curItemType2nd != null;
if (flag2)
{
this.OnClickItemType2nd(this.m_curItemType2nd);
}
}
}
private void OnClickItemType1st(IXUISprite spr)
{
bool flag = spr.spriteName == "l_add_00";
if (flag)
{
spr.SetSprite("l_add_01");
}
else
{
spr.SetSprite("l_add_00");
}
}
private void OnSelectItem(IXUISprite spr)
{
uint num = (uint)spr.ID;
bool flag = this.m_selectArtifactId == num;
if (!flag)
{
this.m_selectArtifactId = num;
this.FillEffectDes(num);
}
}
private bool OnClosed(IXUIButton btn)
{
base.SetVisible(false);
return true;
}
private bool OnClickItemType2nd(IXUICheckBox cb)
{
bool flag = !cb.bChecked;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = this.m_curItemType2nd != null;
if (flag2)
{
this.SetSelectStatus(false);
}
this.m_curItemType2nd = cb;
this.SetSelectStatus(true);
this.FillSuitContent((uint)cb.ID);
result = true;
}
return result;
}
private void SetSelectStatus(bool isSelected)
{
this.m_curItemType2nd.gameObject.transform.Find("UnSelectLab").gameObject.SetActive(!isSelected);
this.m_curItemType2nd.gameObject.transform.Find("SelectLab").gameObject.SetActive(isSelected);
Transform parent = this.m_curItemType2nd.gameObject.transform.parent.parent;
parent.Find("UnSelectLab").gameObject.SetActive(!isSelected);
parent.Find("SelectLab").gameObject.SetActive(isSelected);
IXUISprite ixuisprite = parent.GetComponent("XUISprite") as IXUISprite;
if (isSelected)
{
ixuisprite.SetSprite("l_button_06");
}
else
{
ixuisprite.SetSprite("l_button_07");
}
}
}
}
|