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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class XGuildListView : DlgBase<XGuildListView, XGuildListBehaviour>
{
public XGuildCreateView CreateView
{
get
{
return this._CreateView;
}
}
public override string fileName
{
get
{
return "Guild/GuildListDlg";
}
}
public override int layer
{
get
{
return 1;
}
}
public override int group
{
get
{
return 1;
}
}
public override bool autoload
{
get
{
return true;
}
}
public override bool hideMainMenu
{
get
{
return true;
}
}
public override bool pushstack
{
get
{
return true;
}
}
public override bool fullscreenui
{
get
{
return true;
}
}
private int CurPPT
{
get
{
bool getPPT = this.GetPPT;
if (getPPT)
{
XPlayer player = XSingleton<XEntityMgr>.singleton.Player;
XPlayerAttributes xplayerAttributes = player.Attributes as XPlayerAttributes;
this.m_curPPT = (int)xplayerAttributes.GetAttr(XAttributeDefine.XAttr_POWER_POINT_Basic);
this.GetPPT = false;
}
return this.m_curPPT;
}
}
public static readonly Color TitleUnSelectedColor = new Color(0.607843161f, 0.607843161f, 0.607843161f);
public static readonly Color TitleSelectedColor = Color.white;
private XGuildListDocument _ListDoc;
private XGuildDocument _GuildDoc;
private XGuildCreateView _CreateView;
private XGuildBasicInfoDisplay _BasicInfoDisplayer = new XGuildBasicInfoDisplay();
private int m_curPPT = 0;
private bool GetPPT = false;
protected override void Init()
{
this._ListDoc = XDocuments.GetSpecificDocument<XGuildListDocument>(XGuildListDocument.uuID);
this._ListDoc.GuildListView = this;
this._GuildDoc = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.WrapContentItemUpdated));
base.uiBehaviour.m_WrapContent.RegisterItemInitEventHandler(new WrapItemInitEventHandler(this.WrapContentItemInit));
foreach (IXUIButton ixuibutton in base.uiBehaviour.m_helpList.Keys)
{
Guildintroduce.RowData introduce = this._GuildDoc.GetIntroduce(ixuibutton.gameObject.name);
bool flag = introduce != null;
if (flag)
{
IXUILabel ixuilabel = ixuibutton.gameObject.transform.Find("T").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(introduce.Title);
}
}
DlgHandlerBase.EnsureCreate<XGuildCreateView>(ref this._CreateView, base.uiBehaviour.m_CreatePanel, null, true);
}
protected override void OnUnload()
{
this._ListDoc.GuildListView = null;
DlgHandlerBase.EnsureUnload<XGuildCreateView>(ref this._CreateView);
DlgHandlerBase.EnsureUnload<XTitleBar>(ref base.uiBehaviour.m_TitleBar);
base.OnUnload();
}
public override void Reset()
{
}
public override void RegisterEvent()
{
base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCloseBtnClick));
base.uiBehaviour.m_Create.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnCreateBtnClick));
base.uiBehaviour.m_Search.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnSearchBtnClick));
base.uiBehaviour.m_QuickJoin.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnQuickJoinBtnClick));
base.uiBehaviour.m_TitleBar.RegisterClickEventHandler(new TitleClickEventHandler(this._OnTitleClickEventHandler));
foreach (IXUIButton ixuibutton in base.uiBehaviour.m_helpList.Keys)
{
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._ShowHelpClick));
}
}
protected override void OnShow()
{
base.uiBehaviour.m_SearchText.SetText("");
this._ListDoc.SearchText = "";
this._ListDoc.ReqGuildList();
this._CreateView.SetVisible(false);
this.RefreshPage(true);
base.uiBehaviour.m_TitleBar.Refresh((ulong)((long)XFastEnumIntEqualityComparer<GuildSortType>.ToInt(this._ListDoc.SortType)));
}
private bool _OnTitleClickEventHandler(ulong ID)
{
this._ListDoc.SortType = (GuildSortType)ID;
this._ListDoc.ReqGuildList();
return this._ListDoc.SortDirection > 0;
}
public void RefreshPage(bool bResetPosition = true)
{
List<XGuildListData> listData = this._ListDoc.ListData;
this.GetPPT = true;
base.uiBehaviour.m_WrapContent.SetContentCount(listData.Count, false);
}
public void NewContentAppended()
{
List<XGuildListData> listData = this._ListDoc.ListData;
base.uiBehaviour.m_WrapContent.SetContentCount(listData.Count, false);
}
private bool _ShowHelpClick(IXUIButton button)
{
string helpName;
bool flag = this.m_uiBehaviour.m_helpList.TryGetValue(button, out helpName);
bool result;
if (flag)
{
Guildintroduce.RowData introduce = this._GuildDoc.GetIntroduce(helpName);
bool flag2 = introduce != null;
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemHelp(introduce.Desc, introduce.Title, XStringDefineProxy.GetString(XStringDefine.COMMON_OK));
}
result = true;
}
else
{
result = false;
}
return result;
}
private void WrapContentItemInit(Transform t, int index)
{
IXUIButton ixuibutton = t.Find("ValidContent/Apply").GetComponent("XUIButton") as IXUIButton;
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnJoinBtnClick));
ixuibutton = (t.Find("ValidContent/View").GetComponent("XUIButton") as IXUIButton);
ixuibutton.RegisterClickEventHandler(new ButtonClickEventHandler(this._OnViewBtnClick));
IXUILabel ixuilabel = t.Find("LoadMore").GetComponent("XUILabel") as IXUILabel;
ixuilabel.RegisterLabelClickEventHandler(new LabelClickEventHandler(this._OnLoadMoreClick));
}
private void WrapContentItemUpdated(Transform t, int index)
{
List<XGuildListData> listData = this._ListDoc.ListData;
bool flag = index >= listData.Count;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("Item index out of range: ", index.ToString(), null, null, null, null);
}
else
{
XGuildListData xguildListData = listData[index];
Transform transform = t.Find("LoadMore");
Transform transform2 = t.Find("ValidContent");
IXUISprite ixuisprite = t.Find("Bg").GetComponent("XUISprite") as IXUISprite;
bool flag2 = xguildListData.uid == 0UL;
if (flag2)
{
ixuisprite.SetVisible(false);
transform.gameObject.SetActive(true);
transform2.gameObject.SetActive(false);
}
else
{
ixuisprite.SetVisible(true);
transform.gameObject.SetActive(false);
transform2.gameObject.SetActive(true);
this._BasicInfoDisplayer.Init(t.Find("ValidContent"), false);
this._BasicInfoDisplayer.Set(xguildListData);
IXUIButton ixuibutton = t.Find("ValidContent/Apply").GetComponent("XUIButton") as IXUIButton;
IXUILabel ixuilabel = t.Find("ValidContent/Apply/T").GetComponent("XUILabel") as IXUILabel;
IXUIButton ixuibutton2 = t.Find("ValidContent/View").GetComponent("XUIButton") as IXUIButton;
IXUISprite ixuisprite2 = t.Find("ValidContent/Portrait").GetComponent("XUISprite") as IXUISprite;
ixuibutton.SetEnable(!xguildListData.bIsApplying && !this._GuildDoc.bInGuild, false);
ixuisprite2.SetSprite(XGuildDocument.GetPortraitName(xguildListData.portraitIndex));
bool bIsApplying = xguildListData.bIsApplying;
if (bIsApplying)
{
ixuilabel.SetText(XStringDefineProxy.GetString("APPLYING"));
}
else
{
bool flag3 = !xguildListData.bNeedApprove;
if (flag3)
{
ixuilabel.SetText(XStringDefineProxy.GetString("JOIN"));
}
else
{
ixuilabel.SetText(XStringDefineProxy.GetString("APPLY"));
}
ixuibutton.SetGrey((ulong)xguildListData.requiredPPT < (ulong)((long)this.CurPPT));
}
ixuibutton.ID = (ulong)((long)index);
ixuibutton2.ID = (ulong)((long)index);
}
}
}
private bool _OnCloseBtnClick(IXUIButton go)
{
this.SetVisibleWithAnimation(false, null);
return true;
}
private bool _OnCreateBtnClick(IXUIButton go)
{
bool bInGuild = this._GuildDoc.bInGuild;
bool result;
if (bInGuild)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_GUILD_ALREADY_IN_GUILD, "fece00");
result = true;
}
else
{
this._CreateView.SetVisible(true);
result = true;
}
return result;
}
private bool _OnSearchBtnClick(IXUIButton go)
{
string text = base.uiBehaviour.m_SearchText.GetText();
this._ListDoc.ReqSearch(text);
return true;
}
private bool _OnQuickJoinBtnClick(IXUIButton go)
{
bool bInGuild = this._GuildDoc.bInGuild;
bool result;
if (bInGuild)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_GUILD_ALREADY_IN_GUILD, "fece00");
result = true;
}
else
{
this._ListDoc.ReqQuickJoin();
result = true;
}
return result;
}
private bool _OnViewBtnClick(IXUIButton go)
{
XGuildViewDocument specificDocument = XDocuments.GetSpecificDocument<XGuildViewDocument>(XGuildViewDocument.uuID);
int num = (int)go.ID;
bool flag = num < 0 || num >= this._ListDoc.ListData.Count;
bool result;
if (flag)
{
result = true;
}
else
{
specificDocument.View(this._ListDoc.ListData[num]);
result = true;
}
return result;
}
private bool _OnJoinBtnClick(IXUIButton go)
{
bool bInGuild = this._GuildDoc.bInGuild;
bool result;
if (bInGuild)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_GUILD_ALREADY_IN_GUILD, "fece00");
result = true;
}
else
{
int num = (int)go.ID;
bool flag = num < 0 || num >= this._ListDoc.ListData.Count;
if (flag)
{
result = false;
}
else
{
XGuildListData xguildListData = this._ListDoc.ListData[num];
DlgBase<XGuildApplyView, XGuildApplyBehaviour>.singleton.ShowApply(xguildListData.uid, xguildListData.guildName, xguildListData.requiredPPT, xguildListData.bNeedApprove, xguildListData.announcement);
result = true;
}
}
return result;
}
private void _OnLoadMoreClick(IXUILabel go)
{
this._ListDoc.ReqMoreGuilds();
}
public override void StackRefresh()
{
base.StackRefresh();
base.uiBehaviour.m_WrapContent.RefreshAllVisibleContents();
}
}
}
|