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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class FashionCollectionDlg : DlgBase<FashionCollectionDlg, FashionCollectionDlgBehaviour>
{
public override bool autoload
{
get
{
return true;
}
}
public override string fileName
{
get
{
return "GameSystem/FashionColletionDlg";
}
}
public override bool pushstack
{
get
{
return true;
}
}
public override bool fullscreenui
{
get
{
return true;
}
}
public override bool hideMainMenu
{
get
{
return true;
}
}
public XCharacterInfoView _InfoView;
private XFashionDocument _doc;
private int _selectedSuit = 0;
private List<int> allSuit = new List<int>();
protected override void Init()
{
base.Init();
this._doc = (XSingleton<XGame>.singleton.Doc.GetXComponent(XFashionDocument.uuID) as XFashionDocument);
DlgHandlerBase.EnsureCreate<XCharacterInfoView>(ref this._InfoView, base.uiBehaviour.m_CharacterInfoFrame, null, true);
base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated));
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnCloseClick));
base.uiBehaviour.m_ShopBtn.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnShopClick));
}
protected bool OnCloseClick(IXUIButton button)
{
XSingleton<X3DAvatarMgr>.singleton.OnFashionChanged(XSingleton<XEntityMgr>.singleton.Player);
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(false, null);
this.SetVisible(false, true);
return true;
}
protected override void OnShow()
{
base.OnShow();
this.RefreshData();
}
public override void StackRefresh()
{
this._InfoView.StackRefresh();
this.RefreshData();
}
private void RefreshData()
{
bool flag = this.m_uiBehaviour.m_SnapShot != null;
if (flag)
{
XSingleton<X3DAvatarMgr>.singleton.EnableMainDummy(true, this.m_uiBehaviour.m_SnapShot);
}
this.ShowSuitList();
}
protected override void OnUnload()
{
XSingleton<X3DAvatarMgr>.singleton.OnUIUnloadMainDummy(this.m_uiBehaviour.m_SnapShot);
this._selectedSuit = 0;
this.allSuit.Clear();
DlgHandlerBase.EnsureUnload<XCharacterInfoView>(ref this._InfoView);
}
private void WrapContentItemUpdated(Transform t, int index)
{
bool flag = index < this.allSuit.Count && index >= 0;
if (flag)
{
FashionSuitTable.RowData suitData = this._doc.GetSuitData(this.allSuit[index]);
IXUILabel ixuilabel = t.Find("Label").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(suitData.SuitName);
IXUISprite ixuisprite = t.Find("Icon").GetComponent("XUISprite") as IXUISprite;
string strAtlas = "";
string strSprite = "";
this._doc.GetSuitIcon(suitData, ref strAtlas, ref strSprite);
ixuisprite.SetSprite(strSprite, strAtlas, false);
IXUISprite ixuisprite2 = t.Find("Quality").GetComponent("XUISprite") as IXUISprite;
ixuisprite2.SetSprite(XSingleton<UiUtility>.singleton.GetItemQualityFrame(suitData.SuitQuality, 1));
IXUILabel ixuilabel2 = t.Find("Num").GetComponent("XUILabel") as IXUILabel;
GameObject gameObject = t.Find("GetAll").gameObject;
GameObject gameObject2 = t.Find("NoSale").gameObject;
int suitCollectCount = this._doc.GetSuitCollectCount(this.allSuit[index]);
int suitTotalCount = this._doc.GetSuitTotalCount(this.allSuit[index]);
bool flag2 = suitCollectCount == suitTotalCount;
if (flag2)
{
ixuilabel2.gameObject.SetActive(false);
gameObject.SetActive(true);
}
else
{
ixuilabel2.gameObject.SetActive(true);
gameObject.SetActive(false);
ixuilabel2.SetText(suitCollectCount + "/" + suitTotalCount);
}
gameObject2.SetActive(this._doc.IsSuitNoSale(this.allSuit[index]));
IXUICheckBox ixuicheckBox = t.GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox.ID = (ulong)((long)this.allSuit[index]);
bool flag3 = this._selectedSuit == this.allSuit[index];
if (flag3)
{
ixuicheckBox.bChecked = true;
}
else
{
ixuicheckBox.ForceSetFlag(false);
}
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this.OnSuitClick));
bool flag4 = this._selectedSuit == 0 && index == 0;
if (flag4)
{
ixuicheckBox.bChecked = true;
}
}
}
protected void ShowSuitList()
{
bool flag = this.allSuit.Count == 0;
if (flag)
{
this.allSuit = this._doc.GetSuitCollectionList();
base.uiBehaviour.m_WrapContent.SetContentCount(this.allSuit.Count, false);
base.uiBehaviour.m_ScrollView.ResetPosition();
}
base.uiBehaviour.m_TotalCollection.SetText(this._doc.GetFullCollectionSuitCount() + "/" + this.allSuit.Count);
}
protected bool OnSuitClick(IXUICheckBox box)
{
bool flag = !box.bChecked;
bool result;
if (flag)
{
result = false;
}
else
{
this._selectedSuit = (int)box.ID;
FashionSuitTable.RowData suitData = this._doc.GetSuitData(this._selectedSuit);
this.EquipSuit(suitData);
this.SetSuitInfo(suitData);
result = true;
}
return result;
}
protected void EquipSuit(FashionSuitTable.RowData suitData)
{
XSingleton<X3DAvatarMgr>.singleton.OnFashionSuitChanged(XSingleton<XEntityMgr>.singleton.Player, suitData);
}
protected void SetSuitInfo(FashionSuitTable.RowData suitData)
{
base.uiBehaviour.m_SuitName.SetText(suitData.SuitName);
base.uiBehaviour.FashionPool.ReturnAll(false);
bool flag = suitData.FashionID != null;
if (flag)
{
for (int i = 0; i < suitData.FashionID.Length; i++)
{
GameObject gameObject = base.uiBehaviour.FashionPool.FetchGameObject(false);
gameObject.transform.localPosition = base.uiBehaviour.ShowPos[i];
IXUISprite ixuisprite = gameObject.transform.Find("Icon").GetComponent("XUISprite") as IXUISprite;
XSingleton<XItemDrawerMgr>.singleton.fashionDrawer.DrawItem(gameObject.gameObject, (int)suitData.FashionID[i]);
ixuisprite.SetGrey(this._doc.HasCollected(suitData.FashionID[i]));
ixuisprite.ID = (ulong)suitData.FashionID[i];
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnItemClicked));
}
}
base.uiBehaviour.AttrPool.ReturnAll(false);
int num = 0;
for (int j = 2; j <= 7; j++)
{
SeqListRef<uint> suitPartCountEffect = this._doc.GetSuitPartCountEffect(suitData.SuitID, j);
bool flag2 = suitPartCountEffect.Count == 0;
if (!flag2)
{
for (int k = 0; k < suitPartCountEffect.Count; k++)
{
bool flag3 = suitPartCountEffect[k, 0] == 0u;
if (!flag3)
{
GameObject gameObject2 = base.uiBehaviour.AttrPool.FetchGameObject(false);
gameObject2.transform.localPosition = base.uiBehaviour.AttrPool.TplPos + new Vector3(0f, (float)(-(float)num * base.uiBehaviour.AttrPool.TplHeight));
IXUILabel ixuilabel = gameObject2.transform.Find("Text").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject2.transform.Find("Value").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(XStringDefineProxy.GetString("EQUIP_SUIT_EFFECT", new object[]
{
j
}));
ixuilabel2.SetText(XStringDefineProxy.GetString((XAttributeDefine)suitPartCountEffect[k, 0]) + XAttributeCommon.GetAttrValueStr((int)suitPartCountEffect[k, 0], (float)suitPartCountEffect[k, 1]));
num++;
}
}
}
}
}
private void _OnItemClicked(IXUISprite sp)
{
int itemID = (int)sp.ID;
XItem mainItem = XBagDocument.MakeXItem(itemID, false);
XSingleton<UiUtility>.singleton.ShowTooltipDialog(mainItem, null, sp, false, 0u);
}
private bool OnShopClick(IXUIButton go)
{
DlgBase<GameMallDlg, TabDlgBehaviour>.singleton.ShowMall(XSysDefine.XSys_GameMall_Diamond, MallType.FASHION, 0UL);
return true;
}
}
}
|