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
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XDailyActivitiesDocument : XDocComponent
{
public override uint ID
{
get
{
return XDailyActivitiesDocument.uuID;
}
}
public XDailyActivitiesView View
{
get
{
return this._view;
}
set
{
this._view = value;
}
}
public List<XDailyActivity> ActivityList
{
get
{
return this._ActivityList;
}
}
public uint CurrentExp
{
get
{
return this._CurrentExp;
}
}
public uint WeekExp
{
get
{
return this._WeekExp;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("DailyActivitiesDocument");
private XDailyActivitiesView _view = null;
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static ActivityChestTable _ChestReader = new ActivityChestTable();
private static ActivityTable _ActivityReader = new ActivityTable();
private List<XDailyActivity> _ActivityList = new List<XDailyActivity>();
public uint _CurrentExp = 0u;
public uint _WeekExp = 0u;
private uint _ChestsInfo = 0u;
public List<uint> ChestExps = new List<uint>();
public List<uint> WeekExps = new List<uint>();
public List<string> SpriteName = new List<string>();
public SeqListRef<uint> Reward = default(SeqListRef<uint>);
public int ChestCount;
public uint MaxExp;
public int SeverRedPointNotify = 0;
public static void Execute(OnLoadedCallback callback = null)
{
XDailyActivitiesDocument.AsyncLoader.AddTask("Table/ActivityChest", XDailyActivitiesDocument._ChestReader, false);
XDailyActivitiesDocument.AsyncLoader.AddTask("Table/Activity", XDailyActivitiesDocument._ActivityReader, false);
XDailyActivitiesDocument.AsyncLoader.Execute(callback);
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this._ActivityList.Clear();
this.ChestExps = XSingleton<XGlobalConfig>.singleton.GetUIntList("ActivityChestExp");
this.SpriteName = XSingleton<XGlobalConfig>.singleton.GetStringList("ActivityChestSpriteName");
this.ChestCount = this.ChestExps.Count;
this.MaxExp = this.ChestExps[this.ChestExps.Count - 1];
this.WeekExps = XSingleton<XGlobalConfig>.singleton.GetUIntList("ActivityChestExpWeekly");
}
public void QueryDailyActivityData()
{
RpcC2G_GetActivityInfo rpc = new RpcC2G_GetActivityInfo();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void GetDailyActivityData(ActivityRecord data)
{
this._ChestsInfo = data.ChestGetInfo;
this._CurrentExp = data.ActivityAllValue;
this._WeekExp = data.activityWeekValue;
this._ActivityList.Clear();
for (int i = 0; i < data.ActivityId.Count; i++)
{
ActivityTable.RowData activityBasicInfo = this.GetActivityBasicInfo(data.ActivityId[i]);
XDailyActivity xdailyActivity = new XDailyActivity();
xdailyActivity.id = data.ActivityId[i];
xdailyActivity.currentCount = data.FinishCount[i];
xdailyActivity.requiredCount = data.NeedFinishCount[i];
xdailyActivity.finish = (xdailyActivity.currentCount == xdailyActivity.requiredCount);
xdailyActivity.random = (activityBasicInfo.random > 0u);
xdailyActivity.sysID = activityBasicInfo.id;
this._ActivityList.Add(xdailyActivity);
}
this._ActivityList.Sort(new Comparison<XDailyActivity>(XDailyActivitiesDocument.CompareActivityList));
bool flag = this.View != null && this.View.active;
if (flag)
{
this.View.RefreshPage();
}
bool flag2 = DlgBase<XBriefLevelupView, XBriefLevelupBehaviour>.singleton.IsVisible();
if (flag2)
{
DlgBase<XBriefLevelupView, XBriefLevelupBehaviour>.singleton.FillContent();
}
XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Reward_Activity, true);
}
private static int CompareActivityList(XDailyActivity act1, XDailyActivity act2)
{
bool flag = act1.finish != act2.finish;
int result;
if (flag)
{
result = (act1.finish ? 1 : -1);
}
else
{
bool flag2 = act1.random != act2.random;
if (flag2)
{
result = (act1.random ? -1 : 1);
}
else
{
result = 0;
}
}
return result;
}
public bool IsFinishedAllActivity()
{
for (int i = 0; i < this._ActivityList.Count; i++)
{
bool flag = !this._ActivityList[i].finish;
if (flag)
{
return false;
}
}
return true;
}
public int GetTotalActivityNum()
{
return this._ActivityList.Count;
}
public int GetFinishedActivityNum()
{
int num = 0;
for (int i = 0; i < this._ActivityList.Count; i++)
{
bool flag = !this._ActivityList[i].finish;
if (flag)
{
num++;
}
}
return num;
}
public ActivityTable.RowData GetActivityBasicInfo(uint sortid)
{
for (int i = 0; i < XDailyActivitiesDocument._ActivityReader.Table.Length; i++)
{
bool flag = sortid == XDailyActivitiesDocument._ActivityReader.Table[i].sortid;
if (flag)
{
return XDailyActivitiesDocument._ActivityReader.Table[i];
}
}
return null;
}
public void DealWithBuyReply()
{
bool flag = DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton._livenessActivityHandler != null && DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton._livenessActivityHandler.IsVisible();
if (flag)
{
DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton._livenessActivityHandler.InitView(false);
}
}
public void GetChestReward(uint chestid)
{
uint num = chestid + 1u;
uint level = XSingleton<XAttributeMgr>.singleton.XPlayerData.Level;
for (int i = 0; i < XDailyActivitiesDocument._ChestReader.Table.Length; i++)
{
ActivityChestTable.RowData rowData = XDailyActivitiesDocument._ChestReader.Table[i];
bool flag = rowData.chest != num;
if (!flag)
{
bool flag2 = rowData.level[0] <= level && rowData.level[1] >= level;
if (flag2)
{
this.Reward = rowData.viewabledrop;
return;
}
}
}
XSingleton<XDebug>.singleton.AddErrorLog("Can't Find This Player's ActivityChest,chest id = ", num.ToString(), " level = ", level.ToString(), null, null);
}
public bool IsChestOpend(uint index)
{
uint num = 1u << (int)index;
return (this._ChestsInfo & num) > 0u;
}
public void ReqFetchChest(uint id)
{
RpcC2G_GetActivityChest rpcC2G_GetActivityChest = new RpcC2G_GetActivityChest();
rpcC2G_GetActivityChest.oArg.ChestIndex = id;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetActivityChest);
}
public void OnFetchChest(uint chestID, uint chestInfo, List<uint> itemID, List<uint> itemCount)
{
this._ChestsInfo = chestInfo;
bool flag = this.View != null && this.View.active;
if (flag)
{
this.View.OnChestFetched(chestID);
}
this.SeverRedPointNotify = 0;
XSingleton<XGameSysMgr>.singleton.RecalculateRedPointState(XSysDefine.XSys_Reward_Activity, true);
}
public bool HasCanFetchReward()
{
bool flag = this.SeverRedPointNotify != 0;
bool result;
if (flag)
{
bool flag2 = this.SeverRedPointNotify > 0;
if (flag2)
{
this.SeverRedPointNotify = 0;
result = true;
}
else
{
this.SeverRedPointNotify = 0;
result = false;
}
}
else
{
for (int i = 0; i < this.ChestCount; i++)
{
bool flag3 = !this.IsChestOpend((uint)i) && this.CurrentExp >= this.ChestExps[i];
if (flag3)
{
return true;
}
}
for (int j = 0; j < this.WeekExps.Count; j++)
{
bool flag4 = !this.IsChestOpend((uint)(this.ChestCount + j)) && this.WeekExp >= this.WeekExps[j];
if (flag4)
{
return true;
}
}
result = false;
}
return result;
}
public uint FindNeed2ShowReward()
{
bool flag = this.CurrentExp >= this.MaxExp;
uint result;
if (flag)
{
result = 0u;
}
else
{
for (int i = 0; i < this.ChestCount; i++)
{
bool flag2 = !this.IsChestOpend((uint)i);
if (flag2)
{
return (uint)i;
}
}
result = 0u;
}
return result;
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
bool flag = DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton._livenessActivityHandler != null && DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton._livenessActivityHandler.IsVisible();
if (flag)
{
this.QueryDailyActivityData();
}
}
}
}
|