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
|
using System;
using System.Collections.Generic;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XUtliPoolLib;
namespace XMainClient
{
internal class XTeamDungeonSelectorHandler : DlgHandlerBase
{
private static readonly Color BAD_COLOR = new Color(1f, 0.239215687f, 0.137254909f);
private static readonly Color GOOD_COLOR = new Color(0.392156869f, 0.7176471f, 0.215686277f);
private XTeamDocument _TeamDoc;
private XExpeditionDocument _ExpDoc;
private IXUIScrollView m_DungeonScrollView;
private IXUIScrollView m_CategoryScrollView;
private XUIPool m_DungeonPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private XUIPool m_CategoryPool = new XUIPool(XSingleton<XGameUI>.singleton.m_uiTool);
private List<IXUICheckBox> m_CategoryList = new List<IXUICheckBox>();
private IXUISprite m_Close;
public IXUIButton m_BtnDungeonSelector;
public IXUILabel m_CurrentDungeon;
public IXUILabel m_CurrentCategory;
public GameObject m_SelectorFrame;
protected override void Init()
{
base.Init();
this.m_BtnDungeonSelector = (base.PanelObject.transform.Find("CurrentCategory/Btn").GetComponent("XUIButton") as IXUIButton);
this.m_CurrentDungeon = (base.PanelObject.transform.Find("CurrentDungeon").GetComponent("XUILabel") as IXUILabel);
this.m_CurrentCategory = (base.PanelObject.transform.Find("CurrentCategory").GetComponent("XUILabel") as IXUILabel);
this.m_SelectorFrame = base.PanelObject.transform.Find("Selector").gameObject;
this.m_DungeonScrollView = (this.m_SelectorFrame.transform.Find("Main/Dungeons/Panel").GetComponent("XUIScrollView") as IXUIScrollView);
this.m_CategoryScrollView = (this.m_SelectorFrame.transform.Find("Main/Categories/Panel").GetComponent("XUIScrollView") as IXUIScrollView);
this.m_Close = (this.m_SelectorFrame.transform.Find("Close").GetComponent("XUISprite") as IXUISprite);
this._TeamDoc = XDocuments.GetSpecificDocument<XTeamDocument>(XTeamDocument.uuID);
this._ExpDoc = XDocuments.GetSpecificDocument<XExpeditionDocument>(XExpeditionDocument.uuID);
this._TeamDoc.DungeonSelector = this;
}
public override void RegisterEvent()
{
base.RegisterEvent();
this.m_Close.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this._OnCloseClicked));
this.m_BtnDungeonSelector.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnDungeonSelectorClick));
}
protected override void _DelayInit()
{
base._DelayInit();
Transform transform = this.m_DungeonScrollView.gameObject.transform.Find("Tpl");
this.m_DungeonPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false);
transform = this.m_CategoryScrollView.gameObject.transform.Find("List/CategoryTpl");
this.m_CategoryPool.SetupPool(transform.parent.gameObject, transform.gameObject, 2u, false);
}
protected override void OnShow()
{
base.OnShow();
this.SetCurrentDungeon(true);
}
public override void RefreshData()
{
base.RefreshData();
this.SetCurrentDungeon(false);
}
public override void StackRefresh()
{
base.StackRefresh();
this.SetCurrentDungeon(false);
}
public void ToggleSelector(bool bShow)
{
this.m_SelectorFrame.SetActive(bShow);
if (bShow)
{
this._Setup();
this._DefaultSelect();
}
}
public override void OnUnload()
{
this._TeamDoc.DungeonSelector = null;
base.OnUnload();
}
private void _OnCloseClicked(IXUISprite iSp)
{
this.ToggleSelector(false);
}
private bool _OnDungeonSelectorClick(IXUIButton go)
{
this.ToggleSelector(true);
return true;
}
public void SetCurrentDungeon(bool bCloseSelection)
{
bool flag = this._TeamDoc.currentDungeonID == 0u;
if (flag)
{
this.m_CurrentDungeon.SetText(XStringDefineProxy.GetString("TEAM_NO_TARGET"));
}
else
{
this.m_CurrentDungeon.SetText(string.Format("{0} {1}", this._TeamDoc.currentCategoryName, this._TeamDoc.currentDungeonName));
}
if (bCloseSelection)
{
this.ToggleSelector(false);
}
this.m_BtnDungeonSelector.SetEnable(!this._TeamDoc.bInTeam || this._TeamDoc.bIsLeader, false);
}
private void _DefaultSelect()
{
bool flag = this._TeamDoc.currentDungeonID == 0u;
if (!flag)
{
ExpeditionTable.RowData expeditionDataByID = this._ExpDoc.GetExpeditionDataByID((int)this._TeamDoc.currentDungeonID);
bool flag2 = expeditionDataByID == null;
if (!flag2)
{
ulong num = (ulong)((long)expeditionDataByID.Category);
for (int i = 0; i < this.m_CategoryList.Count; i++)
{
bool flag3 = num == this.m_CategoryList[i].ID;
if (flag3)
{
this.m_CategoryList[i].bChecked = true;
break;
}
}
}
}
}
private void _Setup()
{
this.m_DungeonPool.ReturnAll(false);
this.m_CategoryPool.ReturnAll(false);
this.m_CategoryList.Clear();
List<XTeamCategory> categories = this._ExpDoc.TeamCategoryMgr.m_Categories;
int num = 0;
for (int i = 0; i < categories.Count; i++)
{
XTeamCategory xteamCategory = categories[i];
bool flag = !xteamCategory.HasOpened();
if (!flag)
{
GameObject gameObject = this.m_CategoryPool.FetchGameObject(false);
gameObject.transform.localPosition = new Vector3(this.m_CategoryPool.TplPos.x, this.m_CategoryPool.TplPos.y - (float)(this.m_CategoryPool.TplHeight * num));
IXUICheckBox ixuicheckBox = gameObject.transform.Find("BtnToggle/Normal").GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox.ID = (ulong)((long)xteamCategory.category);
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._CategoryCheckEventHandler));
IXUILabel ixuilabel = gameObject.transform.Find("BtnToggle/Text").GetComponent("XUILabel") as IXUILabel;
IXUILabel ixuilabel2 = gameObject.transform.Find("BtnToggle/SelectedText").GetComponent("XUILabel") as IXUILabel;
string categoryName = XTeamCategory.GetCategoryName(xteamCategory.category);
ixuilabel.SetText(categoryName);
ixuilabel2.SetText(categoryName);
this.m_CategoryList.Add(ixuicheckBox);
num++;
ixuicheckBox.ForceSetFlag(false);
}
}
this.m_CategoryScrollView.ResetPosition();
}
private bool _CategoryCheckEventHandler(IXUICheckBox ckb)
{
bool flag = !ckb.bChecked;
bool result;
if (flag)
{
result = true;
}
else
{
this.m_DungeonPool.FakeReturnAll();
XTeamCategory xteamCategory = this._ExpDoc.TeamCategoryMgr.FindCategory((int)ckb.ID);
bool flag2 = xteamCategory != null;
if (flag2)
{
XPlayerAttributes playerAttributes = XSingleton<XEntityMgr>.singleton.Player.PlayerAttributes;
uint num = (uint)playerAttributes.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic);
uint level = playerAttributes.Level;
int i = 0;
int num2 = 0;
while (i < xteamCategory.expList.Count)
{
ExpeditionTable.RowData rowData = xteamCategory.expList[i];
bool flag3 = rowData == null;
if (!flag3)
{
bool flag4 = !xteamCategory.IsExpOpened(rowData);
if (!flag4)
{
GameObject gameObject = this.m_DungeonPool.FetchGameObject(false);
gameObject.transform.localPosition = new Vector3(this.m_DungeonPool.TplPos.x, this.m_DungeonPool.TplPos.y - (float)(this.m_DungeonPool.TplHeight * num2++));
IXUILabel ixuilabel = gameObject.transform.Find("Name").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(XExpeditionDocument.GetFullName(rowData));
ixuilabel = (gameObject.transform.Find("PPT").GetComponent("XUILabel") as IXUILabel);
ixuilabel.SetText(rowData.DisplayPPT.ToString());
ixuilabel.SetColor((rowData.DisplayPPT <= num) ? XTeamDungeonSelectorHandler.GOOD_COLOR : XTeamDungeonSelectorHandler.BAD_COLOR);
ixuilabel = (gameObject.transform.Find("Level").GetComponent("XUILabel") as IXUILabel);
ixuilabel.SetText(XStringDefineProxy.GetString("LEVEL", new object[]
{
rowData.DisplayLevel.ToString()
}));
ixuilabel.SetColor((rowData.DisplayLevel <= level) ? XTeamDungeonSelectorHandler.GOOD_COLOR : XTeamDungeonSelectorHandler.BAD_COLOR);
Transform transform = gameObject.transform.Find("Normal");
IXUICheckBox ixuicheckBox = transform.GetComponent("XUICheckBox") as IXUICheckBox;
ixuicheckBox.ID = (ulong)((long)rowData.DNExpeditionID);
ixuicheckBox.RegisterOnCheckEventHandler(new CheckBoxOnCheckEventHandler(this._DungeonCheckEventHandler));
IXUIButton ixuibutton = transform.GetComponent("XUIButton") as IXUIButton;
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._DungeonClickEventHandler));
ixuicheckBox.ForceSetFlag((ulong)this._TeamDoc.currentDungeonID == (ulong)((long)rowData.DNExpeditionID));
IXUISprite ixuisprite = gameObject.transform.Find("SisterTA").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = 0UL;
ixuisprite.SetVisible(this._TeamDoc.ShowTarja((uint)rowData.DNExpeditionID));
ixuisprite.RegisterSpritePressEventHandler(new SpritePressEventHandler(this.OnShowTarjaTipHandle));
}
}
i++;
}
}
this.m_DungeonPool.ActualReturnAll(false);
this.m_DungeonScrollView.ResetPosition();
result = true;
}
return result;
}
private bool OnShowTarjaTipHandle(IXUISprite sprite, bool pressed)
{
IXUILabel ixuilabel = sprite.transform.Find("Info").GetComponent("XUILabel") as IXUILabel;
bool flag = ixuilabel == null;
bool result;
if (flag)
{
result = false;
}
else
{
bool flag2 = sprite.ID == 1UL;
if (flag2)
{
ixuilabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC_TEAM")));
}
else
{
ixuilabel.SetText(XSingleton<UiUtility>.singleton.ReplaceReturn(XStringDefineProxy.GetString("TEAM_TARJA_DESC")));
}
ixuilabel.SetVisible(pressed);
result = false;
}
return result;
}
private bool _DungeonClickEventHandler(IXUIButton btn)
{
IXUICheckBox ixuicheckBox = btn.gameObject.GetComponent("XUICheckBox") as IXUICheckBox;
bool bChecked = ixuicheckBox.bChecked;
if (bChecked)
{
this.ToggleSelector(false);
}
return true;
}
private bool _DungeonCheckEventHandler(IXUICheckBox ckb)
{
bool flag = !ckb.bChecked;
bool result;
if (flag)
{
result = true;
}
else
{
this._TeamDoc.TryChangeToExpID((int)ckb.ID);
result = true;
}
return result;
}
}
}
|