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
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
|
using System;
using System.Collections.Generic;
using KKSG;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class WeekEndNestDocument : XDocComponent
{
public override uint ID
{
get
{
return WeekEndNestDocument.uuID;
}
}
public static WeekEndNestDocument Doc
{
get
{
return XSingleton<XGame>.singleton.Doc.GetXComponent(WeekEndNestDocument.uuID) as WeekEndNestDocument;
}
}
public uint LeftCount
{
get
{
return this.m_leftCount;
}
}
public uint CanGetCount
{
get
{
return this.m_canGetCount;
}
}
public uint GetStatus
{
get
{
return this.m_getStatue;
}
}
public uint JoindTimes
{
get
{
return (this.MaxCount() - this.m_leftCount < 0u) ? 0u : (this.MaxCount() - this.m_leftCount);
}
}
public bool NeedLoginShow
{
get
{
return this.m_bNeedLoginShow;
}
set
{
this.m_bNeedLoginShow = value;
}
}
public List<SuperActivityTask.RowData> TaskList
{
get
{
bool flag = this.m_taskList == null;
if (flag)
{
this.m_taskList = XTempActivityDocument.Doc.GetDataByActivityType(this.m_actId);
}
return this.m_taskList;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("WeekEndNestDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static WeekEndNestActivity m_WeekEndNestTable = new WeekEndNestActivity();
public readonly uint m_actId = 15u;
private bool m_bNeedLoginShow = false;
private uint m_parentTaskId = 0u;
private uint m_leftCount = 0u;
private uint m_canGetCount = 1u;
private uint m_getStatue = 0u;
private List<SuperActivityTask.RowData> m_taskList;
public static void Execute(OnLoadedCallback callback = null)
{
WeekEndNestDocument.AsyncLoader.AddTask("Table/WeekEndNestActivity", WeekEndNestDocument.m_WeekEndNestTable, false);
WeekEndNestDocument.AsyncLoader.Execute(callback);
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
}
protected override void EventSubscribe()
{
base.EventSubscribe();
}
public override void OnDetachFromHost()
{
base.OnDetachFromHost();
this.Clear();
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
}
private void OnlineOpenSetTaskId()
{
bool flag = this.m_parentTaskId > 0u;
if (!flag)
{
int serverOpenDay = XActivityDocument.Doc.ServerOpenDay;
bool flag2 = WeekEndNestDocument.m_WeekEndNestTable == null;
if (flag2)
{
this.m_parentTaskId = 0u;
}
else
{
for (int i = 0; i < WeekEndNestDocument.m_WeekEndNestTable.Table.Length; i++)
{
WeekEndNestActivity.RowData rowData = WeekEndNestDocument.m_WeekEndNestTable.Table[i];
bool flag3 = (ulong)rowData.OpenSvrDay[0] <= (ulong)((long)serverOpenDay) && (ulong)rowData.OpenSvrDay[1] >= (ulong)((long)serverOpenDay);
if (flag3)
{
this.m_parentTaskId = rowData.ParentTaskId;
this.m_bNeedLoginShow = true;
this.m_leftCount = this.MaxCount();
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_WeekEndNest, true);
return;
}
}
this.m_parentTaskId = 0u;
}
}
}
public void OfflineOpenSetTaskId()
{
SpActivityOne activity = XTempActivityDocument.Doc.GetActivity(this.m_actId);
bool flag = activity == null;
if (flag)
{
this.m_parentTaskId = 0u;
}
else
{
bool flag2 = this.m_parentTaskId == 0u;
if (flag2)
{
this.m_bNeedLoginShow = true;
}
for (int i = 0; i < activity.task.Count; i++)
{
SuperActivityTask.RowData data = this.GetData(activity.task[i].taskid);
bool flag3 = data != null && data.tasktype == 1u;
if (flag3)
{
this.m_parentTaskId = data.taskid;
int num = (int)(this.MaxCount() - XTempActivityDocument.Doc.GetActivityProgress(this.m_actId, this.m_parentTaskId));
this.m_leftCount = (uint)((num > 0) ? num : 0);
this.m_getStatue = XTempActivityDocument.Doc.GetActivityState(this.m_actId, this.m_parentTaskId);
bool flag4 = data.taskson.Length != 0;
if (flag4)
{
this.m_canGetCount = XTempActivityDocument.Doc.GetActivityProgress(this.m_actId, data.taskson[0]);
this.m_canGetCount = ((this.m_canGetCount > this.m_leftCount) ? this.m_leftCount : this.m_canGetCount);
}
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_WeekEndNest, true);
return;
}
}
this.m_parentTaskId = 0u;
}
}
private void Clear()
{
this.m_parentTaskId = 0u;
this.m_bNeedLoginShow = false;
this.m_getStatue = 0u;
}
private SuperActivityTask.RowData GetData(uint taskId)
{
for (int i = 0; i < this.TaskList.Count; i++)
{
bool flag = this.TaskList[i].taskid == taskId;
if (flag)
{
return this.TaskList[i];
}
}
return null;
}
private SuperActivityTask.RowData GetSonTask(uint parentTaskId)
{
SuperActivityTask.RowData data = this.GetData(parentTaskId);
bool flag = data == null || data.taskson.Length == 0;
SuperActivityTask.RowData result;
if (flag)
{
result = null;
}
else
{
data = this.GetData(data.taskson[0]);
result = data;
}
return result;
}
public int GetDnId()
{
SuperActivityTask.RowData sonTask = this.GetSonTask(this.m_parentTaskId);
bool flag = sonTask == null || sonTask.num.Length == 0;
int result;
if (flag)
{
result = 0;
}
else
{
result = (int)sonTask.num[0];
}
return result;
}
public string GetLevelName()
{
int dnId = this.GetDnId();
bool flag = dnId == 0;
string result;
if (flag)
{
result = "";
}
else
{
XExpeditionDocument xexpeditionDocument = XSingleton<XGame>.singleton.Doc.GetXComponent(XExpeditionDocument.uuID) as XExpeditionDocument;
ExpeditionTable.RowData expeditionDataByID = xexpeditionDocument.GetExpeditionDataByID(dnId);
result = XExpeditionDocument.GetFullName(expeditionDataByID);
}
return result;
}
public string GetTexName()
{
WeekEndNestActivity.RowData byParentTaskId = WeekEndNestDocument.m_WeekEndNestTable.GetByParentTaskId(this.m_parentTaskId);
bool flag = byParentTaskId == null;
string result;
if (flag)
{
result = "";
}
else
{
result = string.Format("{0}{1}", "atlas/UI/common/Pic/", byParentTaskId.BgTexName);
}
return result;
}
public uint MaxCount()
{
SuperActivityTask.RowData data = this.GetData(this.m_parentTaskId);
bool flag = data == null;
uint result;
if (flag)
{
result = 0u;
}
else
{
result = (uint)data.cnt;
}
return result;
}
public SeqListRef<uint> GetReward()
{
SuperActivityTask.RowData data = this.GetData(this.m_parentTaskId);
bool flag = data == null;
SeqListRef<uint> result;
if (flag)
{
result = default(SeqListRef<uint>);
}
else
{
result = data.items;
}
return result;
}
public string GetRules()
{
return XSingleton<UiUtility>.singleton.ReplaceReturn(XSingleton<XStringTable>.singleton.GetString("WeekEndNestRule"));
}
public void ReqGetReward()
{
RpcC2G_GetSpActivityReward rpcC2G_GetSpActivityReward = new RpcC2G_GetSpActivityReward();
rpcC2G_GetSpActivityReward.oArg.actid = this.m_actId;
rpcC2G_GetSpActivityReward.oArg.taskid = this.m_parentTaskId;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetSpActivityReward);
}
public void OnGetReward(GetSpActivityRewardRes oRes)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("CarnivalSuccess"), "fece00");
}
public void TaskChangePtc(uint actId, uint taskId)
{
bool flag = this.m_actId != actId;
if (!flag)
{
SuperActivityTask.RowData data = this.GetData(taskId);
bool flag2 = data == null || data.tasktype != 1u;
if (!flag2)
{
bool flag3 = taskId != this.m_parentTaskId;
this.m_parentTaskId = taskId;
int num = (int)(this.MaxCount() - XTempActivityDocument.Doc.GetActivityProgress(actId, this.m_parentTaskId));
this.m_leftCount = (uint)((num > 0) ? num : 0);
this.m_getStatue = XTempActivityDocument.Doc.GetActivityState(actId, this.m_parentTaskId);
bool flag4 = data != null && data.taskson.Length != 0;
if (flag4)
{
this.m_canGetCount = XTempActivityDocument.Doc.GetActivityProgress(actId, data.taskson[0]);
this.m_canGetCount = ((this.m_canGetCount > this.m_leftCount) ? this.m_leftCount : this.m_canGetCount);
}
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_WeekEndNest, true);
bool flag5 = DlgBase<WeekEndNestDlg, WeekEndNestBehaviour>.singleton.IsVisible();
if (flag5)
{
DlgBase<WeekEndNestDlg, WeekEndNestBehaviour>.singleton.Refresh();
}
bool flag6 = flag3;
if (flag6)
{
bool flag7 = DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton.IsVisible();
if (flag7)
{
bool flag8 = DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton.ActivityHandler != null && DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton.ActivityHandler.IsVisible();
if (flag8)
{
DlgBase<DailyActivityDlg, TabDlgBehaviour>.singleton.ActivityHandler.RefreshMulActivity();
}
}
}
}
}
}
public void OnSystemChanged(List<uint> openIds, List<uint> closedIds)
{
for (int i = 0; i < openIds.Count; i++)
{
bool flag = (ulong)openIds[i] == (ulong)((long)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_WeekEndNest));
if (flag)
{
this.OnlineOpenSetTaskId();
return;
}
}
for (int j = 0; j < closedIds.Count; j++)
{
bool flag2 = (ulong)closedIds[j] == (ulong)((long)XFastEnumIntEqualityComparer<XSysDefine>.ToInt(XSysDefine.XSys_WeekEndNest));
if (flag2)
{
this.Clear();
bool flag3 = DlgBase<WeekEndNestDlg, WeekEndNestBehaviour>.singleton.IsVisible();
if (flag3)
{
DlgBase<WeekEndNestDlg, WeekEndNestBehaviour>.singleton.SetVisible(false, true);
}
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_WeekEndNest, true);
break;
}
}
}
}
}
|