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
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient.UI
{
internal class GuildSalayDlg : DlgBase<GuildSalayDlg, GuildSalayBehavior>
{
public override string fileName
{
get
{
return "Guild/GuildSalaryDlg";
}
}
public override int layer
{
get
{
return 1;
}
}
public override int group
{
get
{
return 1;
}
}
public override bool pushstack
{
get
{
return true;
}
}
public override bool hideMainMenu
{
get
{
return true;
}
}
public override bool fullscreenui
{
get
{
return true;
}
}
public override bool autoload
{
get
{
return true;
}
}
private XGuildSalaryDocument _Doc;
private GuildSalaryDescHandler m_DescHandler;
private SeqListRef<uint> m_GuildSalayList;
private SeqListRef<uint> m_NextGuildSalayList;
protected override void Init()
{
base.Init();
this._Doc = XDocuments.GetSpecificDocument<XGuildSalaryDocument>(XGuildSalaryDocument.uuID);
base.uiBehaviour.m_WrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnRewardWrapUpdate));
base.uiBehaviour.m_DropWrapContent.RegisterItemUpdateEventHandler(new WrapItemUpdateEventHandler(this.OnNextRewardUpdate));
base.uiBehaviour.m_CanNot.SetText(XStringDefineProxy.GetString("GuildSalaryMessage"));
}
protected override void OnShow()
{
base.OnShow();
this._Doc.SendAskGuildWageInfo();
this.Refresh();
}
public void Refresh()
{
this.SetSalaryInfo();
this.RefreshTopPlayers();
bool flag = this._Doc.RewardState == WageRewardState.notreward;
if (flag)
{
this.SetLastWeekBaseInfo();
}
else
{
this.SetThisWeekInfo();
}
}
private void SetLastWeekBaseInfo()
{
base.uiBehaviour.m_GuildLevel.SetText(this._Doc.LastLevel.ToString());
base.uiBehaviour.m_TitleLabel.SetText(XStringDefineProxy.GetString("GUILD_SALAY_LASTWEEK"));
base.uiBehaviour.m_GuildPosition.SetText(XGuildDocument.GuildPP.GetPositionName(this._Doc.LastPosition, false));
bool flag = this._Doc.LastGrade < 1u;
if (flag)
{
base.uiBehaviour.m_LastWeekGrade.SetTexturePath("atlas/UI/GameSystem/Activity/pj_0");
}
else
{
base.uiBehaviour.m_LastWeekGrade.SetTexturePath(string.Format("atlas/UI/GameSystem/Activity/pj_{0}", this._Doc.LastGrade - 1u));
}
base.uiBehaviour.m_LastWeekScore.SetText(this._Doc.LastScore.ToString());
this.m_GuildSalayList = this._Doc.GetGuildSalayList(this._Doc.LastLevel, this._Doc.LastPosition, this._Doc.LastGrade);
base.uiBehaviour.m_WrapContent.SetContentCount((this.m_GuildSalayList.Count > 0) ? this.m_GuildSalayList.Count : 0, false);
base.uiBehaviour.m_RewardScrollView.ResetPosition();
this.SetNextRewardTemp(this._Doc.LastGrade, this._Doc.MulMaxScore);
base.uiBehaviour.m_GetButton.SetVisible(true);
}
private void SetThisWeekInfo()
{
XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
base.uiBehaviour.m_TitleLabel.SetText(XStringDefineProxy.GetString("GUILD_SALAY_THISWEEK"));
base.uiBehaviour.m_GuildLevel.SetText(specificDocument.BasicData.level.ToString());
base.uiBehaviour.m_GuildPosition.SetText(XGuildDocument.GuildPP.GetPositionName(specificDocument.Position, false));
bool flag = this._Doc.CurGrade < 1u;
if (flag)
{
base.uiBehaviour.m_LastWeekGrade.SetTexturePath("atlas/UI/GameSystem/Activity/pj_0");
}
else
{
base.uiBehaviour.m_LastWeekGrade.SetTexturePath(string.Format("atlas/UI/GameSystem/Activity/pj_{0}", this._Doc.CurGrade - 1u));
}
base.uiBehaviour.m_LastWeekScore.SetText(this._Doc.CurScore.ToString());
this.m_GuildSalayList = this._Doc.GetGuildSalayList(specificDocument.BasicData.level, specificDocument.Position, this._Doc.CurGrade);
this.SetNextRewardTemp(this._Doc.CurGrade, this._Doc.CurMulScore);
base.uiBehaviour.m_WrapContent.SetContentCount((this.m_GuildSalayList.Count > 0) ? this.m_GuildSalayList.Count : 0, false);
base.uiBehaviour.m_RewardScrollView.ResetPosition();
base.uiBehaviour.m_GetButton.SetVisible(false);
base.uiBehaviour.m_DropView.gameObject.SetActive(false);
}
private void SetSalaryInfo()
{
bool flag = this._Doc.CurGrade < 1u;
if (flag)
{
base.uiBehaviour.m_thisWeekGrade.SetTexturePath("atlas/UI/GameSystem/Activity/pj_0");
}
else
{
base.uiBehaviour.m_thisWeekGrade.SetTexturePath(string.Format("atlas/UI/GameSystem/Activity/pj_{0}", this._Doc.CurGrade - 1u));
}
base.uiBehaviour.m_thisWeekScore.SetText(this._Doc.CurScore.ToString());
base.uiBehaviour.m_BottomInfo.SetInfo(this._Doc.RoleNum.Score, this._Doc.RoleNum.Value);
base.uiBehaviour.m_radarMap.SetSite(0, this._Doc.RoleNum.Percent);
base.uiBehaviour.m_LeftInfo.SetInfo(this._Doc.Prestige.Score, this._Doc.Prestige.Value);
base.uiBehaviour.m_radarMap.SetSite(2, this._Doc.Prestige.Percent);
base.uiBehaviour.m_UpInfo.SetInfo(this._Doc.Activity.Score, this._Doc.Activity.Value);
base.uiBehaviour.m_radarMap.SetSite(3, this._Doc.Activity.Percent);
base.uiBehaviour.m_RightInfo.SetInfo(this._Doc.Exp.Score, this._Doc.Exp.Value);
base.uiBehaviour.m_radarMap.SetSite(1, this._Doc.Exp.Percent);
}
private void RefreshTopPlayers()
{
List<GuildActivityRole> topPlayers = this._Doc.TopPlayers;
int num = (topPlayers == null) ? 0 : topPlayers.Count;
int i = 0;
int num2 = base.uiBehaviour.topPlayers.Length;
while (i < num2)
{
bool flag = i < num;
if (flag)
{
base.uiBehaviour.topPlayers[i].SetVisible(true);
base.uiBehaviour.topPlayers[i].SetText(topPlayers[i].name);
IXUILabel ixuilabel = base.uiBehaviour.topPlayers[i].gameObject.transform.Find("t1").GetComponent("XUILabel") as IXUILabel;
ixuilabel.SetText(topPlayers[i].score.ToString());
}
else
{
base.uiBehaviour.topPlayers[i].SetVisible(false);
}
i++;
}
}
public override void RegisterEvent()
{
base.RegisterEvent();
base.uiBehaviour.m_Close.RegisterClickEventHandler(new ButtonClickEventHandler(this.ClickClose));
base.uiBehaviour.m_GetButton.RegisterClickEventHandler(new ButtonClickEventHandler(this.ClickGet));
base.uiBehaviour.m_BottomInfo.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickDescHandler));
base.uiBehaviour.m_UpInfo.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickDescHandler));
base.uiBehaviour.m_LeftInfo.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickDescHandler));
base.uiBehaviour.m_RightInfo.RegisterClickEventHandler(new ButtonClickEventHandler(this.OnClickDescHandler));
base.uiBehaviour.m_DropClose.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(this.OnClickNextHandler));
base.uiBehaviour.m_ShowNextReward.RegisterLabelClickEventHandler(new LabelClickEventHandler(this.OnShowNextReward));
}
private void SetNextRewardTemp(uint grade, uint mul)
{
bool flag = grade > 1u && grade <= 5u;
base.uiBehaviour.m_ShowNextReward.SetVisible(flag);
base.uiBehaviour.m_LastScoreLabel.SetVisible(flag);
bool flag2 = flag;
if (flag2)
{
string nextGradeString = this.GetNextGradeString(grade);
base.uiBehaviour.m_ShowNextReward.SetText(XStringDefineProxy.GetString("GuildSalaryNextReward", new object[]
{
nextGradeString
}));
base.uiBehaviour.m_LastScoreLabel.SetText(XStringDefineProxy.GetString("GuildSalaryMulDesc", new object[]
{
nextGradeString,
mul
}));
}
}
private string GetNextGradeString(uint grade)
{
string result = "S";
switch (grade)
{
case 2u:
result = "S";
break;
case 3u:
result = "A";
break;
case 4u:
result = "B";
break;
case 5u:
result = "C";
break;
}
return result;
}
protected override void OnHide()
{
base.OnHide();
bool flag = this.m_DescHandler != null;
if (flag)
{
this.m_DescHandler.SetVisible(false);
}
}
protected override void OnUnload()
{
base.uiBehaviour.m_thisWeekGrade.SetTexturePath("");
base.uiBehaviour.m_LastWeekGrade.SetTexturePath("");
base.OnUnload();
}
protected override void OnLoad()
{
bool flag = this.m_DescHandler != null;
if (flag)
{
DlgHandlerBase.EnsureUnload<GuildSalaryDescHandler>(ref this.m_DescHandler);
}
base.OnLoad();
}
private bool OnClickDescHandler(IXUIButton sprite)
{
this._Doc.SelectTabs = (int)sprite.ID;
DlgHandlerBase.EnsureCreate<GuildSalaryDescHandler>(ref this.m_DescHandler, base.uiBehaviour.m_Root, true, null);
return true;
}
private bool ClickClose(IXUIButton btn)
{
this.SetVisibleWithAnimation(false, null);
return true;
}
private bool ClickGet(IXUIButton btn)
{
this._Doc.SendGuildWageReward();
return true;
}
private void OnRewardWrapUpdate(Transform t, int index)
{
bool flag = index >= this.m_GuildSalayList.Count;
if (!flag)
{
this.SetWrapContent(t, this.m_GuildSalayList[index, 0], this.m_GuildSalayList[index, 1]);
}
}
private void OnNextRewardUpdate(Transform t, int index)
{
bool flag = index >= this.m_NextGuildSalayList.Count;
if (!flag)
{
this.SetWrapContent(t, this.m_NextGuildSalayList[index, 0], this.m_NextGuildSalayList[index, 1]);
}
}
private void OnClickNextHandler(IXUISprite sprite)
{
base.uiBehaviour.m_DropView.gameObject.SetActive(false);
}
private void OnShowNextReward(IXUILabel label)
{
base.uiBehaviour.m_DropView.gameObject.SetActive(true);
bool flag = this._Doc.RewardState == WageRewardState.notreward;
if (flag)
{
this.m_NextGuildSalayList = this._Doc.GetGuildSalayList(this._Doc.LastLevel, this._Doc.LastPosition, this._Doc.LastGrade - 1u);
}
else
{
XGuildDocument specificDocument = XDocuments.GetSpecificDocument<XGuildDocument>(XGuildDocument.uuID);
this.m_NextGuildSalayList = this._Doc.GetGuildSalayList(specificDocument.BasicData.level, specificDocument.Position, this._Doc.CurGrade - 1u);
}
base.uiBehaviour.m_DropWrapContent.SetContentCount((this.m_NextGuildSalayList.Count > 0) ? this.m_GuildSalayList.Count : 0, false);
base.uiBehaviour.m_DropScrollView.ResetPosition();
}
private void SetWrapContent(Transform t, uint seq0, uint seq1)
{
XSingleton<XItemDrawerMgr>.singleton.normalItemDrawer.DrawItem(t.gameObject, (int)seq0, (int)seq1, false);
IXUISprite ixuisprite = t.Find("Icon").GetComponent("XUISprite") as IXUISprite;
ixuisprite.ID = (ulong)seq0;
ixuisprite.RegisterSpriteClickEventHandler(new SpriteClickEventHandler(XSingleton<UiUtility>.singleton.OnItemClick));
}
}
}
|