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
|
using System;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class FashionBagHandler : DlgHandlerBase
{
protected override string FileName
{
get
{
return "ItemNew/FashionListPanel";
}
}
public GameObject m_ComboBox;
public GameObject m_ItemBagPanel;
public IXUIButton m_ShopButton;
public IXUIButton m_BtnClothes;
public IXUISprite m_OutLookRedPoint;
public IXUIButton m_CollectionButton;
public IXUIButton m_TotalAttrButton;
public GameObject m_TotalAttrPanel;
public IXUIButton m_Help;
public IXUISprite[] m_Fashion = new IXUISprite[10];
public IXUISprite[] m_FashionBg = new IXUISprite[10];
private FashionAttrTotalHandler _attrHandler;
private XFashionDocument _doc;
private FashionComboBox _comboBox;
private XBagWindow bagWindow;
private uint _timer;
private float update_interval = 180f;
protected override void Init()
{
base.Init();
this._doc = (XSingleton<XGame>.singleton.Doc.GetXComponent(XFashionDocument.uuID) as XFashionDocument);
this._doc.FashionDlg = this;
this.m_ComboBox = base.PanelObject.transform.Find("ComboBox").gameObject;
this.m_ItemBagPanel = base.PanelObject.gameObject;
this.m_ShopButton = (base.PanelObject.transform.Find("BtnShop").GetComponent("XUIButton") as IXUIButton);
this.m_Help = (base.transform.Find("Help").GetComponent("XUIButton") as IXUIButton);
for (int i = XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_START); i < XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_END); i++)
{
this.m_Fashion[i] = (base.PanelObject.transform.Find("EquipFrame/Part" + i + "/Icon").GetComponent("XUISprite") as IXUISprite);
this.m_FashionBg[i] = (base.PanelObject.transform.Find("EquipFrame/Part" + i + "/Bg").GetComponent("XUISprite") as IXUISprite);
this.m_FashionBg[i].ID = (ulong)((long)i);
}
this.m_CollectionButton = (base.PanelObject.transform.Find("BtnCollection").GetComponent("XUIButton") as IXUIButton);
this.m_TotalAttrButton = (base.PanelObject.transform.Find("BtnAttrTotal").GetComponent("XUIButton") as IXUIButton);
this.m_TotalAttrPanel = base.PanelObject.transform.Find("AttrTotal").gameObject;
this.bagWindow = new XBagWindow(this.m_ItemBagPanel, new ItemUpdateHandler(this.WrapContentItemUpdated), new GetItemHandler(this._doc.GetItem));
this.bagWindow.Init();
this._comboBox = new FashionComboBox(this.m_ComboBox, new ComboboxClickEventHandler(this.OnSelectPart), 2);
this.m_BtnClothes = (base.PanelObject.transform.Find("Btnclothes").GetComponent("XUIButton") as IXUIButton);
this.m_OutLookRedPoint = (base.PanelObject.transform.Find("Btnclothes/RedPoint").GetComponent("XUISprite") as IXUISprite);
this.m_OutLookRedPoint.SetVisible(false);
for (int j = XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_START); j < XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_END); j++)
{
this._comboBox.AddItem(XSingleton<UiUtility>.singleton.GetFashionPartName((FashionPosition)j, false), j);
}
this._comboBox.AddItem(XSingleton<UiUtility>.singleton.GetFashionPartName(FashionPosition.Hair, false), XFastEnumIntEqualityComparer<FashionPosition>.ToInt(FashionPosition.Hair));
this._comboBox.AddItem(XStringDefineProxy.GetString("ALL"), -1);
this._comboBox.SetSelect(-1);
DlgHandlerBase.EnsureCreate<FashionAttrTotalHandler>(ref this._attrHandler, this.m_TotalAttrPanel, null, false);
this._attrHandler.ShowCharm = true;
}
public override void RegisterEvent()
{
base.RegisterEvent();
for (int i = XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_START); i < XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_END); i++)
{
this.m_Fashion[i].RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnItemClicked));
this.m_FashionBg[i].RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnBgClicked));
}
this.m_BtnClothes.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClothClick));
this.m_TotalAttrButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnTotalAttrClick));
this.m_CollectionButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCollectionClick));
this.m_ShopButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShopClick));
this.m_Help.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnHelpClicked));
}
public void RefreshOutLookRedPoint()
{
this.m_BtnClothes.SetVisible(XSingleton<XGameSysMgr>.singleton.IsSystemOpened(XSysDefine.XSys_Fashion_OutLook));
XFashionStorageDocument specificDocument = XDocuments.GetSpecificDocument<XFashionStorageDocument>(XFashionStorageDocument.uuID);
this.m_OutLookRedPoint.SetVisible(specificDocument.RedPoint);
}
public bool OnHelpClicked(IXUIButton button)
{
DlgBase<XCommonHelpTipView, XCommonHelpTipBehaviour>.singleton.ShowHelp(XSysDefine.XSys_Fashion_Fashion);
return true;
}
protected override void OnShow()
{
base.OnShow();
this.ShowFashions();
this.RefreshOutLookRedPoint();
this.bagWindow.ChangeData(new ItemUpdateHandler(this.WrapContentItemUpdated), new GetItemHandler(this._doc.GetItem));
this.bagWindow.OnShow();
this._timer = XSingleton<XTimerMgr>.singleton.SetTimer(this.update_interval, new XTimerMgr.ElapsedEventHandler(this.UpdateFahionCD), null);
}
protected override void OnHide()
{
this.bagWindow.OnHide();
bool flag = this._timer > 0u;
if (flag)
{
XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
this._timer = 0u;
}
base.OnHide();
}
public override void OnUnload()
{
bool flag = this._timer > 0u;
if (flag)
{
XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
this._timer = 0u;
}
DlgHandlerBase.EnsureUnload<FashionAttrTotalHandler>(ref this._attrHandler);
this._doc.FashionDlg = null;
this.bagWindow = null;
base.OnUnload();
}
public override void StackRefresh()
{
base.StackRefresh();
this.ShowFashions();
this.RefreshOutLookRedPoint();
this.bagWindow.OnShow();
bool flag = this._timer > 0u;
if (flag)
{
XSingleton<XTimerMgr>.singleton.KillTimer(this._timer);
this._timer = 0u;
}
this._timer = XSingleton<XTimerMgr>.singleton.SetTimer(this.update_interval, new XTimerMgr.ElapsedEventHandler(this.UpdateFahionCD), null);
}
public void ShowFashions()
{
for (int i = XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_START); i < XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_END); i++)
{
ClientFashionData partFashion = this._doc.GetPartFashion(i);
this.m_Fashion[i].ID = partFashion.uid;
XSingleton<XItemDrawerMgr>.singleton.fashionDrawer.DrawItem(this.m_Fashion[i].gameObject.transform.parent.gameObject, partFashion);
this.m_Fashion[i].RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnItemClicked));
this.SetFashionCD(this.m_Fashion[i].gameObject.transform.parent.gameObject, partFashion);
}
bool flag = this.bagWindow != null;
if (flag)
{
this.bagWindow.RefreshWindow();
}
}
public void UpdateBag()
{
this.bagWindow.UpdateBag();
}
private void UpdateFahionCD(object o)
{
bool flag = base.IsVisible();
if (flag)
{
for (int i = XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_START); i < XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_END); i++)
{
ClientFashionData partFashion = this._doc.GetPartFashion(i);
this.SetFashionCD(this.m_Fashion[i].gameObject.transform.parent.gameObject, partFashion);
}
bool flag2 = this.bagWindow != null;
if (flag2)
{
this.bagWindow.RefreshWindow();
}
}
this._timer = XSingleton<XTimerMgr>.singleton.SetTimer(this.update_interval, new XTimerMgr.ElapsedEventHandler(this.UpdateFahionCD), null);
}
private void SetFashionCD(GameObject item, ClientFashionData d)
{
Transform transform = item.transform.Find("Icon/TimeBg/cd");
bool flag = transform == null;
if (!flag)
{
bool flag2 = d == null;
if (flag2)
{
transform.parent.gameObject.SetActive(false);
}
else
{
IXUISprite ixuisprite = transform.GetComponent("XUISprite") as IXUISprite;
ItemList.RowData itemConf = XBagDocument.GetItemConf((int)d.itemID);
bool flag3 = itemConf != null;
if (flag3)
{
bool flag4 = itemConf.TimeLimit == 0u;
if (flag4)
{
transform.parent.gameObject.SetActive(false);
}
else
{
transform.parent.gameObject.SetActive(true);
bool flag5 = d.timeleft < 0.0;
if (flag5)
{
ixuisprite.SetFillAmount(0f);
}
else
{
ixuisprite.SetFillAmount(1f - (float)d.timeleft / itemConf.TimeLimit);
}
}
}
else
{
transform.parent.gameObject.SetActive(false);
}
}
}
}
private void WrapContentItemUpdated(Transform t, int index)
{
IXUISprite ixuisprite = t.Find("Icon").GetComponent("XUISprite") as IXUISprite;
GameObject gameObject = t.Find("P").gameObject;
GameObject gameObject2 = t.Find("RedPoint").gameObject;
bool flag = this.bagWindow.m_XItemList == null || index >= this.bagWindow.m_XItemList.Count || index < 0;
if (flag)
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(t.gameObject, null);
this.SetFashionCD(t.gameObject, null);
gameObject2.SetActive(false);
}
else
{
XItem xitem = this.bagWindow.m_XItemList[index];
ClientFashionData clientFashionData = this._doc.FindFashion(xitem.uid);
bool flag2 = clientFashionData == null;
if (flag2)
{
XSingleton<XItemDrawerMgr>.singleton.DrawItem(t.gameObject, null);
this.SetFashionCD(t.gameObject, null);
gameObject2.SetActive(false);
}
else
{
XSingleton<XItemDrawerMgr>.singleton.fashionDrawer.DrawItem(t.gameObject, clientFashionData);
ixuisprite.ID = xitem.uid;
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnItemClicked));
bool flag3 = index % this.bagWindow.COL_COUNT == 0;
if (flag3)
{
gameObject.SetActive(true);
}
else
{
gameObject.SetActive(false);
}
this.SetFashionCD(t.gameObject, clientFashionData);
gameObject2.SetActive(this._doc.HasFashionRedPoint(clientFashionData));
}
}
}
private bool OnClothClick(IXUIButton btn)
{
DlgBase<FashionStorageDlg, FashionStorageBehaviour>.singleton.SetVisibleWithAnimation(true, null);
return true;
}
private void _OnItemClicked(IXUISprite sp)
{
ulong id = sp.ID;
ClientFashionData clientFashionData = this._doc.FindFashion(id);
bool flag = clientFashionData != null;
if (flag)
{
XItem mainItem = this._doc.MakeXItem(clientFashionData);
XSingleton<UiUtility>.singleton.ShowTooltipDialog(mainItem, null, sp, true, 0u);
}
}
private void _OnBgClicked(IXUISprite sp)
{
int part = (int)sp.ID;
XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("FASHION_EQUIP_HINT"), XSingleton<UiUtility>.singleton.GetFashionPartName((FashionPosition)part, false)), "fece00");
}
private bool OnTotalAttrClick(IXUIButton button)
{
this._attrHandler.SetVisible(true);
return true;
}
private void OnSelectPart(int value)
{
this._doc.fashion_filter = value;
this.bagWindow.UpdateBag();
}
private bool OnCollectionClick(IXUIButton button)
{
DlgBase<FashionCollectionDlg, FashionCollectionDlgBehaviour>.singleton.SetVisible(true, true);
return true;
}
private bool OnShopClick(IXUIButton button)
{
XSingleton<UiUtility>.singleton.ShowItemAccess(199, null);
return true;
}
public void OnBodyFashionDisappear(int pos)
{
ClientFashionData partFashion = this._doc.GetPartFashion(pos);
XSingleton<XItemDrawerMgr>.singleton.fashionDrawer.DrawItem(this.m_Fashion[pos].gameObject.transform.parent.gameObject, partFashion);
this.SetFashionCD(this.m_Fashion[pos].gameObject.transform.parent.gameObject, partFashion);
}
public void OnBagFashionDisappear(ulong uid)
{
this.bagWindow.UpdateBag();
}
}
}
|