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
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class CharacterEquipHandler : DlgHandlerBase
{
public GameObject[] EquipGo
{
get
{
return this.m_EquipGo;
}
}
protected override string FileName
{
get
{
return "ItemNew/EquipFrame";
}
}
public string EnhanceMasterPath
{
get
{
bool flag = string.IsNullOrEmpty(this.m_enhanceMasterPath);
if (flag)
{
this.m_enhanceMasterPath = XSingleton<XGlobalConfig>.singleton.GetValue("EnhanceMasterEffectPath");
}
return this.m_enhanceMasterPath;
}
}
public static int Equip_Slot_Count = XBagDocument.EquipMax;
private GameObject[] m_EquipGo = new GameObject[CharacterEquipHandler.Equip_Slot_Count];
public IXUISprite[] m_EquipSlots = new IXUISprite[CharacterEquipHandler.Equip_Slot_Count];
public IXUISprite[] m_EquipBg = new IXUISprite[CharacterEquipHandler.Equip_Slot_Count];
private XItemSelector _ItemSelector = new XItemSelector(0u);
private XItemMorePowerfulTipMgr _MorePowerfulMgr = new XItemMorePowerfulTipMgr();
private XItemMorePowerfulTipMgr _WeakMorePowerfulMgr = new XItemMorePowerfulTipMgr();
private XItemMorePowerfulTipMgr _ItemShining = null;
private XItemMorePowerfulTipMgr _SuitFxMgr = new XItemMorePowerfulTipMgr();
private Dictionary<GameObject, uint> _ShiningTimerTokens = new Dictionary<GameObject, uint>();
private XUIPool m_ItemPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private bool bNormal = true;
private XFx m_EnhanceMasterEffect;
private ArtifactQuanlityFx[] m_fuseBreakFx = new ArtifactQuanlityFx[CharacterEquipHandler.Equip_Slot_Count];
private EquipFusionDocument m_doc;
private string m_enhanceMasterPath = string.Empty;
protected override void Init()
{
base.Init();
this.m_doc = EquipFusionDocument.Doc;
this.m_ItemPool.SetupPool(base.PanelObject, base.PanelObject.transform.Find("ItemTpl").gameObject, (uint)CharacterEquipHandler.Equip_Slot_Count, false);
for (int i = 0; i < CharacterEquipHandler.Equip_Slot_Count; i++)
{
this.m_EquipGo[i] = this.m_ItemPool.FetchGameObject(false);
GameObject gameObject = base.PanelObject.transform.Find("Part" + i).gameObject;
this.m_EquipGo[i].transform.localPosition = gameObject.transform.localPosition;
this.m_EquipSlots[i] = (this.m_EquipGo[i].transform.Find("Icon").GetComponent("XUISprite") as IXUISprite);
this.m_EquipBg[i] = (gameObject.transform.Find("Bg").GetComponent("XUISprite") as IXUISprite);
}
this._MorePowerfulMgr.Load("ItemMorePowerfulTip2");
this._MorePowerfulMgr.SetupPool(base.PanelObject);
this._WeakMorePowerfulMgr.SetupPool(base.PanelObject);
Transform transform = base.PanelObject.transform.Find("SuitFx");
bool flag = transform != null;
if (flag)
{
this._SuitFxMgr.LoadFromUI(transform.gameObject);
this._SuitFxMgr.SetupPool(base.PanelObject);
}
}
public override void RegisterEvent()
{
base.RegisterEvent();
for (int i = 0; i < CharacterEquipHandler.Equip_Slot_Count; i++)
{
this.m_EquipBg[i].ID = (ulong)((long)i);
this.m_EquipBg[i].RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnSlotBgClick));
}
}
protected override void OnShow()
{
base.OnShow();
bool flag = this.m_EnhanceMasterEffect != null;
if (flag)
{
this.m_EnhanceMasterEffect.SetActive(false);
}
this._ItemSelector.Hide();
this._MorePowerfulMgr.ReturnAll();
this._WeakMorePowerfulMgr.ReturnAll();
this._SuitFxMgr.ReturnAll();
this.ShowEquipments();
}
protected override void OnHide()
{
bool flag = this.m_EnhanceMasterEffect != null;
if (flag)
{
this.m_EnhanceMasterEffect.SetActive(false);
}
this._StopItemShining();
this.RestQuanlityFx();
base.OnHide();
}
public override void OnUnload()
{
this._ItemSelector.Unload();
this._MorePowerfulMgr.Unload();
this._WeakMorePowerfulMgr.Unload();
this._SuitFxMgr.Unload();
bool flag = this.m_EnhanceMasterEffect != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this.m_EnhanceMasterEffect, true);
this.m_EnhanceMasterEffect = null;
}
this._StopItemShining();
for (int i = 0; i < CharacterEquipHandler.Equip_Slot_Count; i++)
{
bool flag2 = this.m_fuseBreakFx[i] != null;
if (flag2)
{
this.m_fuseBreakFx[i].Reset();
this.m_fuseBreakFx[i] = null;
}
}
base.OnUnload();
}
public override void StackRefresh()
{
bool flag = this.m_EnhanceMasterEffect != null;
if (flag)
{
this.m_EnhanceMasterEffect.SetActive(false);
}
base.StackRefresh();
}
private void _StopItemShining()
{
foreach (uint token in this._ShiningTimerTokens.Values)
{
XSingleton<XTimerMgr>.singleton.KillTimer(token);
}
this._ShiningTimerTokens.Clear();
}
private void _StartItemShining()
{
this._StopItemShining();
this._ItemShining.FakeReturnAll();
for (int i = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_START); i < XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_END); i++)
{
bool flag = this.m_EquipSlots[i].ID == 0UL;
if (!flag)
{
GameObject gameObject = this._ItemShining.SetTip(this.m_EquipSlots[i]);
this._ShowItemShining(gameObject);
gameObject.transform.Find("Icon").gameObject.SetActive(false);
}
}
this._ItemShining.ActualReturnAll();
}
private void _ShowItemShining(object o)
{
GameObject gameObject = o as GameObject;
bool flag = this._ShiningTimerTokens.ContainsKey(gameObject);
if (flag)
{
IXUISpriteAnimation ixuispriteAnimation = gameObject.transform.Find("Icon").GetComponent("XUISpriteAnimation") as IXUISpriteAnimation;
ixuispriteAnimation.Reset();
ixuispriteAnimation.gameObject.SetActive(true);
}
float interval = XSingleton<XCommon>.singleton.RandomFloat(3f, 15f);
this._ShiningTimerTokens[gameObject] = XSingleton<XTimerMgr>.singleton.SetTimer(interval, new XTimerMgr.ElapsedEventHandler(this._ShowItemShining), gameObject);
}
public void SetRedPoints(List<int> equipList)
{
this._MorePowerfulMgr.ReturnAll();
bool flag = equipList != null;
if (flag)
{
foreach (int num in equipList)
{
this._MorePowerfulMgr.SetTip(this.m_EquipSlots[num]);
}
}
}
public void SetArrows(List<int> equipList)
{
this._WeakMorePowerfulMgr.ReturnAll();
bool flag = equipList != null;
if (flag)
{
foreach (int num in equipList)
{
this._WeakMorePowerfulMgr.SetTip(this.m_EquipSlots[num]);
}
}
}
public void ShowEquipments()
{
XBodyBag equipBag = XSingleton<XGame>.singleton.Doc.XBagDoc.EquipBag;
for (int i = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_START); i < XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_END); i++)
{
XItemDrawerMgr.Param.bHideBinding = true;
bool flag = equipBag[i] != null;
if (flag)
{
this.m_EquipGo[i].SetActive(true);
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_EquipGo[i], equipBag[i]);
this.m_EquipSlots[i].ID = equipBag[i].uid;
XEquipItem xequipItem = equipBag[i] as XEquipItem;
this.SetEffect(this.m_EquipGo[i], xequipItem.fuseInfo.BreakNum, i);
}
else
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_EquipGo[i], null);
this.m_EquipSlots[i].ID = 0UL;
this.SetEffect(this.m_EquipGo[i], 0u, i);
}
}
}
public void ShowNormalEquip(bool bFlag)
{
this.bNormal = bFlag;
for (int i = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_START); i < XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_END); i++)
{
this.m_EquipGo[i].SetActive(bFlag);
}
}
public void PlayEnhanceMasterEffect()
{
bool flag = this.m_EnhanceMasterEffect != null;
if (flag)
{
this.m_EnhanceMasterEffect.SetActive(false);
}
bool flag2 = this.m_EnhanceMasterEffect == null;
if (flag2)
{
this.m_EnhanceMasterEffect = XSingleton<XFxMgr>.singleton.CreateFx(this.EnhanceMasterPath, null, true);
}
else
{
bool flag3 = this.m_EnhanceMasterEffect != null;
if (flag3)
{
this.m_EnhanceMasterEffect.SetActive(true);
}
}
this.m_EnhanceMasterEffect.Play(base.PanelObject.transform.parent.parent, Vector3.zero, Vector3.one, 1f, true, false);
}
private void SetEffect(GameObject go, uint breakLevel, int slot)
{
bool flag = slot >= this.m_fuseBreakFx.Length;
if (!flag)
{
bool flag2 = go == null;
if (!flag2)
{
ArtifactQuanlityFx artifactQuanlityFx = this.m_fuseBreakFx[slot];
bool flag3 = artifactQuanlityFx == null;
if (flag3)
{
artifactQuanlityFx = new ArtifactQuanlityFx();
this.m_fuseBreakFx[slot] = artifactQuanlityFx;
}
string path;
bool flag4 = !this.m_doc.GetEffectPath(breakLevel, out path);
if (flag4)
{
artifactQuanlityFx.Reset();
}
else
{
bool flag5 = !artifactQuanlityFx.IsCanReuse((ulong)breakLevel);
if (flag5)
{
artifactQuanlityFx.SetData((ulong)breakLevel, go.transform.Find("Icon/Icon/Effects"), path);
}
}
}
}
}
private void RestQuanlityFx()
{
for (int i = 0; i < CharacterEquipHandler.Equip_Slot_Count; i++)
{
bool flag = this.m_fuseBreakFx[i] != null;
if (flag)
{
this.m_fuseBreakFx[i].Reset();
}
}
}
public void UpdateEquipSlot(XItem item)
{
bool flag = item == null;
if (!flag)
{
EquipList.RowData equipConf = XBagDocument.GetEquipConf(item.itemID);
bool flag2 = equipConf == null;
if (!flag2)
{
bool flag3 = this.m_EquipSlots[(int)equipConf.EquipPos].ID == item.uid;
if (flag3)
{
XItemDrawerMgr.Param.bHideBinding = true;
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_EquipGo[(int)equipConf.EquipPos], item);
XEquipItem xequipItem = item as XEquipItem;
this.SetEffect(this.m_EquipGo[(int)equipConf.EquipPos], xequipItem.fuseInfo.BreakNum, (int)equipConf.EquipPos);
}
}
}
}
public void SetEquipSlot(int slot, XItem item)
{
XItemDrawerMgr.Param.bHideBinding = true;
XSingleton<XItemDrawerMgr>.singleton.DrawItem(this.m_EquipGo[slot], item);
this.m_EquipSlots[slot].ID = ((item != null) ? item.uid : 0UL);
bool flag = item != null;
if (flag)
{
XEquipItem xequipItem = item as XEquipItem;
this.SetEffect(this.m_EquipGo[slot], xequipItem.fuseInfo.BreakNum, slot);
}
else
{
this.SetEffect(this.m_EquipGo[slot], 0u, slot);
}
}
public void RegisterItemClickEvents(SpriteClickEventHandler handle = null)
{
SpriteClickEventHandler eventHandler = handle;
bool flag = handle == null;
if (flag)
{
eventHandler = new SpriteClickEventHandler(CharacterEquipHandler.OnItemClicked);
}
for (int i = 0; i < CharacterEquipHandler.Equip_Slot_Count; i++)
{
this.m_EquipSlots[i].RegisterSpriteClickEventHandler(eventHandler);
}
}
public void SelectEquip(ulong uid)
{
bool flag = uid == 0UL;
if (flag)
{
this._ItemSelector.Hide();
}
else
{
for (int i = 0; i < CharacterEquipHandler.Equip_Slot_Count; i++)
{
bool flag2 = this.m_EquipSlots[i].ID == uid;
if (flag2)
{
this._ItemSelector.Select(this.m_EquipSlots[i]);
break;
}
}
}
}
public static void OnItemClicked(IXUISprite iSp)
{
XItem itemByUID = XSingleton<XGame>.singleton.Doc.XBagDoc.GetItemByUID(iSp.ID);
bool flag = itemByUID != null;
if (flag)
{
XBodyBag bodyBag = itemByUID.Description.BodyBag;
bool flag2 = bodyBag != null && bodyBag.HasItem(itemByUID.uid);
if (flag2)
{
XSingleton<TooltipParam>.singleton.bEquiped = true;
XSingleton<UiUtility>.singleton.ShowTooltipDialog(itemByUID, null, iSp, true, 0u);
}
else
{
XSingleton<UiUtility>.singleton.ShowTooltipDialogWithSearchingCompare(itemByUID, iSp, true, 0u);
}
}
}
private void _OnSlotBgClick(IXUISprite iSp)
{
EquipPosition equipPosition = (EquipPosition)iSp.ID;
string text = XSingleton<UiUtility>.singleton.GetEquipPartName(equipPosition, true);
bool flag = equipPosition == EquipPosition.Earrings || equipPosition == EquipPosition.Rings || equipPosition == EquipPosition.Necklace;
if (flag)
{
text = XStringDefineProxy.GetString("SHIPIN_FROM", new object[]
{
text
});
}
XSingleton<UiUtility>.singleton.ShowSystemTip(text, "fece00");
}
public void PlaySuitFx(List<int> equipPos)
{
this._SuitFxMgr.FakeReturnAll();
for (int i = 0; i < equipPos.Count; i++)
{
GameObject gameObject = this._SuitFxMgr.SetTip(this.m_EquipSlots[equipPos[i]]);
IXUITweenTool ixuitweenTool = gameObject.GetComponent("XUIPlayTween") as IXUITweenTool;
ixuitweenTool.PlayTween(true, -1f);
}
this._SuitFxMgr.ActualReturnAll();
}
}
}
|