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
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
|
using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using UnityEngine;
using XMainClient.UI;
using XMainClient.UI.UICommon;
using XUtliPoolLib;
namespace XMainClient
{
internal class XGuildCollectDocument : XDocComponent
{
public override uint ID
{
get
{
return XGuildCollectDocument.uuID;
}
}
public GuildCampPartyReward RewardReader
{
get
{
return XGuildCollectDocument._rewardReader;
}
}
public bool ActivityState
{
get
{
return this._activityState;
}
}
public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("GuildCollectDocument");
public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();
private static GuildCampPartyReward _rewardReader = new GuildCampPartyReward();
private bool _activityState = false;
private bool _lotteryMachineState = false;
public List<uint> NpcPool = new List<uint>();
public List<uint> LotteryMachineList = new List<uint>();
public Dictionary<uint, uint> NpcIndex = new Dictionary<uint, uint>();
public List<CollectNpcInfo> NpcList = new List<CollectNpcInfo>();
private int _npcMaxShowNum;
private CollectNpcRefreshMode _npcRefreshMode;
private uint _lastMeetLotteryUid;
private float _lotteryWaitTime;
private string _lotteryProcessText;
private string _lotteryProcessTips;
private uint _lastSendNpcID = 0u;
private float _lastSendNpcTime;
public Dictionary<uint, int> CollectUseDict = new Dictionary<uint, int>();
public bool MainInterfaceBtnState = false;
public List<XFx> _fxList = new List<XFx>();
private static readonly string m_fxPath = "Effects/FX_Particle/Scene/Lzg_scene/rwts_05";
public double SignTime;
public uint LeftTime;
private int SUMMONLEFTTIME = 300;
private string NORMALNAME = "";
private string SPECIALNAME = "";
private uint _hallTimeToken;
private LinkedList<ParabolaFx> _lotteryFxLink = new LinkedList<ParabolaFx>();
private XFx _lotteryBoxFx;
private static readonly string LotteryFlyFXPATH = "Effects/FX_Particle/UIfx/UI_ghpd_rabbit_Clip02";
private static readonly string LotteryBoxFXPATH = "Effects/FX_Particle/UIfx/UI_ghpd_rabbit_Clip01";
public Dictionary<uint, LotteryCD> LotteryCDInfo = new Dictionary<uint, LotteryCD>();
public int LotteryTimes = 3;
public float GuildCollecLotteryCD = 120f;
public static void Execute(OnLoadedCallback callback = null)
{
XGuildCollectDocument.AsyncLoader.AddTask("Table/GuildCampPartyReward", XGuildCollectDocument._rewardReader, false);
XGuildCollectDocument.AsyncLoader.Execute(callback);
}
protected override void EventSubscribe()
{
base.EventSubscribe();
}
public override void OnAttachToHost(XObject host)
{
base.OnAttachToHost(host);
this._activityState = false;
this._lotteryMachineState = false;
}
public override void OnEnterSceneFinally()
{
base.OnEnterSceneFinally();
bool flag = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GUILD_HALL;
if (flag)
{
this._lotteryWaitTime = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryWaitTime"));
this._lotteryProcessText = XStringDefineProxy.GetString("GuildCollectProcessText");
this._lotteryProcessTips = XStringDefineProxy.GetString("GuildCollectProcessTips");
this.LotteryTimes = int.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryTimes"));
this.GuildCollecLotteryCD = float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryCD"));
List<int> intList = XSingleton<XGlobalConfig>.singleton.GetIntList("GuildCollectNpcShowNum");
XQualitySetting.ESetting quality = (XQualitySetting.ESetting)XQualitySetting.GetQuality();
int num = XFastEnumIntEqualityComparer<XQualitySetting.ESetting>.ToInt(quality);
bool flag2 = num > intList.Count - 1;
if (flag2)
{
num = intList.Count - 1;
}
this._npcMaxShowNum = intList[num];
this._npcRefreshMode = ((XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollectNpcRefreshMode") == "0") ? CollectNpcRefreshMode.Random : CollectNpcRefreshMode.Distance);
this.NpcIndex.Clear();
this.NpcList.Clear();
this.NpcPool.Clear();
this.LotteryMachineList.Clear();
bool activityState = this._activityState;
if (activityState)
{
this.RefreshTime(null);
this.InitNpcList();
bool lotteryMachineState = this._lotteryMachineState;
if (lotteryMachineState)
{
this.SetLotteryMachineState(true, true);
}
}
this.SetMainInterfaceBtnState(false);
}
}
public int CheckLotteryCD(uint uid)
{
LotteryCD lotteryCD;
bool flag = this.LotteryCDInfo.TryGetValue(uid, out lotteryCD);
int result;
if (flag)
{
bool flag2 = lotteryCD.Times < this.LotteryTimes;
if (flag2)
{
lotteryCD.Times++;
result = -1;
}
else
{
int num = (int)(Time.time - lotteryCD.LastLotteryTime - this.GuildCollecLotteryCD);
bool flag3 = num >= 0;
if (flag3)
{
lotteryCD.Times = 1;
lotteryCD.LastLotteryTime = Time.time;
result = -1;
}
else
{
result = -num;
}
}
}
else
{
lotteryCD = new LotteryCD();
lotteryCD.Times = 1;
lotteryCD.LastLotteryTime = Time.time;
this.LotteryCDInfo[uid] = lotteryCD;
result = -1;
}
return result;
}
public void SetActivityState(bool state)
{
bool flag = this._activityState != state;
if (flag)
{
this._activityState = state;
XSingleton<XDebug>.singleton.AddGreenLog("set guildcollect state = ", state.ToString(), null, null, null, null);
bool flag2 = XSingleton<XScene>.singleton.SceneType == SceneType.SCENE_GUILD_HALL;
if (flag2)
{
bool activityState = this._activityState;
if (activityState)
{
this.RefreshTime(null);
this.InitNpcList();
}
else
{
foreach (KeyValuePair<uint, uint> keyValuePair in this.NpcIndex)
{
XSingleton<XEntityMgr>.singleton.DestroyNpc(keyValuePair.Value);
}
for (int i = 0; i < this.NpcPool.Count; i++)
{
XSingleton<XEntityMgr>.singleton.DestroyNpc(this.NpcPool[i]);
}
this.NpcIndex.Clear();
this.NpcList.Clear();
this.NpcPool.Clear();
}
}
bool flag3 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
if (flag3)
{
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.OnGuildSysChange();
}
}
}
public void InitNpcList()
{
int num = this._npcMaxShowNum;
this.NORMALNAME = XStringDefineProxy.GetString("GuildCollectSummonNormal");
this.SPECIALNAME = XStringDefineProxy.GetString("GuildCollectSummonSpecial");
uint num2 = 101u;
for (;;)
{
XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(num2);
bool flag = byNPCID == null || byNPCID.NPCType != 4u;
if (flag)
{
break;
}
XNpc xnpc = XSingleton<XEntityMgr>.singleton.CreateNpc(num2, true);
xnpc.EngineObject.Position = XGameUI.Far_Far_Away;
this.NpcPool.Add(num2);
num--;
bool flag2 = num <= 0;
if (flag2)
{
break;
}
num2 += 1u;
}
}
public void SyncNpcList(List<GuildCampSpriteInfo> list)
{
HashSet<uint> hashSet = new HashSet<uint>();
for (int i = 0; i < list.Count; i++)
{
hashSet.Add(list[i].sprite_id);
}
for (int j = this.NpcList.Count - 1; j >= 0; j--)
{
bool flag = hashSet.Contains(this.NpcList[j].id);
if (flag)
{
hashSet.Remove(this.NpcList[j].id);
}
else
{
this.SetNpcInValid(j);
this.NpcList.RemoveAt(j);
}
}
bool flag2 = false;
for (int k = 0; k < list.Count; k++)
{
bool flag3 = hashSet.Contains(list[k].sprite_id);
if (flag3)
{
flag2 = true;
Vector3 pos;
pos= new Vector3((float)(list[k].position >> 16) / 100f, 0f, (float)(list[k].position & 65535) / 100f);
string name = string.IsNullOrEmpty(list[k].summoner) ? this.NORMALNAME : string.Format("{0}{1}", list[k].summoner, this.SPECIALNAME);
this.NpcList.Add(new CollectNpcInfo(list[k].sprite_id, pos, name));
}
}
bool flag4 = flag2;
if (flag4)
{
this.SortNpcByMode(this._npcRefreshMode);
}
this.DealWithNpcList();
}
public void OnMeetNpc(uint uid)
{
bool flag = this.NpcIndex.ContainsValue(uid);
if (flag)
{
foreach (KeyValuePair<uint, uint> keyValuePair in this.NpcIndex)
{
bool flag2 = keyValuePair.Value == uid;
if (flag2)
{
bool flag3 = this._lastSendNpcID == keyValuePair.Key && Time.time < this._lastSendNpcTime;
if (flag3)
{
return;
}
RpcC2G_GetGuildCamPartyRandItem rpcC2G_GetGuildCamPartyRandItem = new RpcC2G_GetGuildCamPartyRandItem();
rpcC2G_GetGuildCamPartyRandItem.oArg.query_type = 2u;
rpcC2G_GetGuildCamPartyRandItem.oArg.npc_id = keyValuePair.Key;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCamPartyRandItem);
this._lastSendNpcTime = Time.time + 0.5f;
return;
}
}
}
XSingleton<UiUtility>.singleton.ShowSystemTip(ErrorCode.ERR_GUILDACMPPATY_SPRITE_ONTEXIST, "fece00");
}
public void OnMeetLottery(uint uid)
{
bool flag = DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.IsVisible();
if (!flag)
{
int num = this.CheckLotteryCD(uid);
bool flag2 = num != -1;
if (flag2)
{
XSingleton<UiUtility>.singleton.ShowSystemTip(string.Format(XStringDefineProxy.GetString("GuildCollectLotteryCDTips"), num), "fece00");
}
else
{
this._lastMeetLotteryUid = uid;
DlgBase<GuildInheritProcessDlg, GuildInheritProcessBehaviour>.singleton.ShowProcess(this._lotteryWaitTime, this._lotteryProcessText, this._lotteryProcessTips, new GuildInheritProcessDlg.OnSliderProcessEnd(this.QueryLottery));
this.SetMoveState(false);
XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(uid);
bool flag3 = npc == null;
if (!flag3)
{
npc.ShowUp(null);
bool flag4 = npc != null;
if (flag4)
{
XSingleton<XAudioMgr>.singleton.PlaySound(npc, AudioChannel.Motion, "Audio/UI/UI_rabbit");
}
XSingleton<XTimerMgr>.singleton.SetTimer(float.Parse(XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecBoxFxTime")), new XTimerMgr.ElapsedEventHandler(this.DelayCreateLotteryBoxFx), uid);
string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxNum").Split(new char[]
{
'='
});
bool flag5 = array.Length < 2;
if (!flag5)
{
int num2 = XSingleton<XCommon>.singleton.RandomInt(int.Parse(array[0]), int.Parse(array[1]) + 1);
array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxProduce").Split(new char[]
{
'='
});
float min = float.Parse(array[0]);
float max = float.Parse(array[1]);
for (int i = 0; i < num2; i++)
{
XSingleton<XTimerMgr>.singleton.SetTimer(XSingleton<XCommon>.singleton.RandomFloat(min, max), new XTimerMgr.ElapsedEventHandler(this.DelayCreateLotteryFlyFx), uid);
}
}
}
}
}
}
public void DelayCreateLotteryBoxFx(object o)
{
uint id = (uint)o;
XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(id);
bool flag = npc == null;
if (!flag)
{
bool flag2 = this._lotteryBoxFx != null;
if (flag2)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._lotteryBoxFx, true);
}
this._lotteryBoxFx = XSingleton<XFxMgr>.singleton.CreateFx(XGuildCollectDocument.LotteryBoxFXPATH, null, true);
this._lotteryBoxFx.Play(npc.EngineObject.Position, Quaternion.identity, Vector3.one, 1f);
}
}
public void DelayCreateLotteryFlyFx(object o)
{
uint id = (uint)o;
XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(id);
bool flag = npc == null || XSingleton<XEntityMgr>.singleton.Player == null;
if (!flag)
{
this.CreatLotteryFx(npc.EngineObject.Position, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position + new Vector3(0f, 0.3f));
}
}
public void QueryLottery()
{
this.SetMoveState(true);
RpcC2G_GetGuildCamPartyRandItem rpcC2G_GetGuildCamPartyRandItem = new RpcC2G_GetGuildCamPartyRandItem();
rpcC2G_GetGuildCamPartyRandItem.oArg.query_type = 1u;
rpcC2G_GetGuildCamPartyRandItem.oArg.npc_id = this._lastMeetLotteryUid;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCamPartyRandItem);
}
public void SetMoveState(bool state)
{
bool flag = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.Nav != null;
if (flag)
{
XSingleton<XEntityMgr>.singleton.Player.Nav.Interrupt();
XSingleton<XEntityMgr>.singleton.Player.Nav.Enabled = state;
}
XSingleton<XInput>.singleton.Freezed = !state;
}
public void DealWithNpcList()
{
bool flag = this._npcRefreshMode == CollectNpcRefreshMode.Distance;
if (flag)
{
this.NpcList.Sort(new Comparison<CollectNpcInfo>(this.Compare));
}
int num = this._npcMaxShowNum;
for (int i = 0; i < this.NpcList.Count; i++)
{
bool flag2 = this.NpcIndex.ContainsKey(this.NpcList[i].id);
if (flag2)
{
num--;
}
}
bool flag3 = num > 0;
if (flag3)
{
for (int j = 0; j < this.NpcList.Count; j++)
{
bool use = this.NpcList[j].use;
if (!use)
{
bool flag4 = !this.NpcIndex.ContainsKey(this.NpcList[j].id);
if (flag4)
{
this.CreateNpc(this.NpcList[j].pos, this.NpcList[j].id, this.NpcList[j].name);
num--;
bool flag5 = num <= 0;
if (flag5)
{
break;
}
}
}
}
}
}
private int Compare(CollectNpcInfo x, CollectNpcInfo y)
{
bool flag = x.id == y.id;
int result;
if (flag)
{
result = 0;
}
else
{
float num = Vector3.Distance(x.pos, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position);
float num2 = Vector3.Distance(y.pos, XSingleton<XEntityMgr>.singleton.Player.EngineObject.Position);
result = ((num > num2) ? 1 : -1);
}
return result;
}
public void SortNpcByMode(CollectNpcRefreshMode mode)
{
bool flag = mode == CollectNpcRefreshMode.Distance;
if (flag)
{
this.NpcList.Sort(new Comparison<CollectNpcInfo>(this.Compare));
}
else
{
XSingleton<UiUtility>.singleton.Shuffle<CollectNpcInfo>(ref this.NpcList);
}
}
public void SetNpcInValid(int index)
{
uint num = 0u;
bool flag = this.NpcIndex.TryGetValue(this.NpcList[index].id, out num);
if (flag)
{
this.ReturnPool(num);
this.NpcIndex.Remove(this.NpcList[index].id);
bool flag2 = XSingleton<XInput>.singleton.LastNpc != null && XSingleton<XInput>.singleton.LastNpc.TypeID == num;
if (flag2)
{
bool flag3 = XSingleton<XEntityMgr>.singleton.Player != null && XSingleton<XEntityMgr>.singleton.Player.Nav != null;
if (flag3)
{
XSingleton<XEntityMgr>.singleton.Player.Nav.Interrupt();
}
XSingleton<XInput>.singleton.LastNpc = null;
}
}
}
public void ReturnPool(uint uid)
{
XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(uid);
bool flag = npc != null;
if (flag)
{
npc.EngineObject.Position = XGameUI.Far_Far_Away;
this.NpcPool.Add(uid);
}
}
public void CreateNpc(Vector3 pos, uint npcID, string name)
{
bool flag = this.NpcPool.Count == 0;
if (flag)
{
XSingleton<XDebug>.singleton.AddErrorLog("Get guildcollect Npc by pool error! It's a empty pool.", null, null, null, null, null);
}
else
{
int index = this.NpcPool.Count - 1;
uint num = this.NpcPool[index];
this.NpcPool.RemoveAt(index);
XNpc npc = XSingleton<XEntityMgr>.singleton.GetNpc(num);
bool flag2 = npc == null;
if (flag2)
{
XSingleton<XDebug>.singleton.AddErrorLog("create npc by pool error. id = ", num.ToString(), null, null, null, null);
}
else
{
bool flag3 = npc.BillBoard != null;
if (flag3)
{
npc.BillBoard.OnGuildCollectNpcNameChange(name);
}
npc.EngineObject.Position = pos;
npc.EngineObject.LocalEulerAngles = new Vector3(0f, XSingleton<XCommon>.singleton.RandomFloat(-180f, 180f), 0f);
this.NpcIndex[npcID] = num;
}
}
}
public void SetLotteryMachineState(bool state, bool force = false)
{
bool flag = XSingleton<XScene>.singleton.SceneType != SceneType.SCENE_GUILD_HALL;
if (!flag)
{
bool flag2 = !force && state == this._lotteryMachineState;
if (!flag2)
{
this._lotteryMachineState = state;
bool lotteryMachineState = this._lotteryMachineState;
if (lotteryMachineState)
{
uint num = 100u;
for (;;)
{
XNpcInfo.RowData byNPCID = XSingleton<XEntityMgr>.singleton.NpcInfo.GetByNPCID(num);
bool flag3 = byNPCID == null || byNPCID.NPCType != 5u;
if (flag3)
{
break;
}
XNpc xnpc = XSingleton<XEntityMgr>.singleton.CreateNpc(num, true);
this.LotteryMachineList.Add(num);
XFx xfx = XSingleton<XFxMgr>.singleton.CreateFx(XGuildCollectDocument.m_fxPath, null, true);
bool flag4 = xfx != null && xnpc != null;
if (flag4)
{
this._fxList.Add(xfx);
xfx.Play(xnpc.EngineObject, new Vector3(-0.05f, xnpc.Height + 0.6f, 0f), Vector3.one, 1f, false, false, "", 0f);
}
num -= 1u;
}
}
else
{
for (int i = 0; i < this.LotteryMachineList.Count; i++)
{
XSingleton<XEntityMgr>.singleton.DestroyNpc(this.LotteryMachineList[i]);
}
for (int j = 0; j < this._fxList.Count; j++)
{
bool flag5 = this._fxList[j] != null;
if (flag5)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._fxList[j], true);
}
}
this._fxList.Clear();
this.LotteryMachineList.Clear();
}
}
}
}
public override void OnLeaveScene()
{
base.OnLeaveScene();
this.NpcIndex.Clear();
this.NpcList.Clear();
this.NpcPool.Clear();
this.LotteryMachineList.Clear();
for (int i = 0; i < this._fxList.Count; i++)
{
bool flag = this._fxList[i] != null;
if (flag)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._fxList[i], true);
}
}
this._fxList.Clear();
bool flag2 = this._lotteryFxLink.Count != 0;
if (flag2)
{
LinkedListNode<ParabolaFx> next;
for (LinkedListNode<ParabolaFx> linkedListNode = this._lotteryFxLink.First; linkedListNode != null; linkedListNode = next)
{
next = linkedListNode.Next;
linkedListNode.Value.Destroy();
this._lotteryFxLink.Remove(linkedListNode);
}
XSingleton<XDebug>.singleton.AddGreenLog("Clear guildcollect fx link, cout = ", this._lotteryFxLink.Count.ToString(), null, null, null, null);
}
bool flag3 = this._lotteryBoxFx != null;
if (flag3)
{
XSingleton<XFxMgr>.singleton.DestroyFx(this._lotteryBoxFx, true);
this._lotteryBoxFx = null;
}
}
public void SetMainInterfaceBtnState(bool state)
{
this.MainInterfaceBtnState = state;
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshH5ButtonState(XSysDefine.XSys_GuildCollectMainInterface, true);
}
public void QuerySummon()
{
SeqList<int> sequenceList = XSingleton<XGlobalConfig>.singleton.GetSequenceList("GuildCampSummonSpiritCost", false);
string text = string.Format(XStringDefineProxy.GetString("GuildCollectSummonTips"), XLabelSymbolHelper.FormatSmallIcon(sequenceList[0, 0]), sequenceList[0, 1]);
text = XSingleton<UiUtility>.singleton.ReplaceReturn(text);
string @string = XStringDefineProxy.GetString("COMMON_OK");
string string2 = XStringDefineProxy.GetString("COMMON_CANCEL");
XSingleton<UiUtility>.singleton.ShowModalDialog(text, @string, string2, new ButtonClickEventHandler(this.OnSummonSure));
}
public bool OnSummonSure(IXUIButton btn)
{
DlgBase<ModalDlg, ModalDlgBehaviour>.singleton.SetVisible(false, true);
RpcC2G_GuildPartySummonSpirit rpc = new RpcC2G_GuildPartySummonSpirit();
XSingleton<XClientNetwork>.singleton.Send(rpc);
return true;
}
public void QueryGetRewardCount()
{
RpcC2G_GetGuildPartyReceiveInfo rpc = new RpcC2G_GetGuildPartyReceiveInfo();
XSingleton<XClientNetwork>.singleton.Send(rpc);
}
public void OnUseCountGet(List<MapIntItem> list)
{
this.CollectUseDict.Clear();
for (int i = 0; i < list.Count; i++)
{
this.CollectUseDict[(uint)list[i].key] = (int)list[i].value;
}
bool flag = DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.IsVisible();
if (flag)
{
DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.Refresh();
}
}
public void QueryGetReward(uint id)
{
RpcC2G_GetGuildCampPartyReward rpcC2G_GetGuildCampPartyReward = new RpcC2G_GetGuildCampPartyReward();
rpcC2G_GetGuildCampPartyReward.oArg.reward_id = id;
XSingleton<XClientNetwork>.singleton.Send(rpcC2G_GetGuildCampPartyReward);
}
protected override void OnReconnected(XReconnectedEventArgs arg)
{
}
public void CreatLotteryFx(Vector3 startPos, Vector3 endPos)
{
string[] array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxDuration").Split(new char[]
{
'='
});
bool flag = array.Length < 2;
if (!flag)
{
float duration = XSingleton<XCommon>.singleton.RandomFloat(float.Parse(array[0]), float.Parse(array[1]));
array = XSingleton<XGlobalConfig>.singleton.GetValue("GuildCollecLotteryFxSpeed").Split(new char[]
{
'='
});
bool flag2 = array.Length < 2;
if (!flag2)
{
float speedY = XSingleton<XCommon>.singleton.RandomFloat(float.Parse(array[0]), float.Parse(array[1]));
ParabolaFx value = new ParabolaFx(XGuildCollectDocument.LotteryFlyFXPATH, duration, speedY, startPos, endPos);
this._lotteryFxLink.AddLast(value);
}
}
}
public override void Update(float fDeltaT)
{
base.Update(fDeltaT);
bool flag = !this._activityState;
if (!flag)
{
bool flag2 = this._lotteryFxLink.Count == 0;
if (!flag2)
{
LinkedListNode<ParabolaFx> next;
for (LinkedListNode<ParabolaFx> linkedListNode = this._lotteryFxLink.First; linkedListNode != null; linkedListNode = next)
{
next = linkedListNode.Next;
bool flag3 = !linkedListNode.Value.Update();
if (flag3)
{
this._lotteryFxLink.Remove(linkedListNode);
}
}
}
}
}
public void SetTime(uint leftTime)
{
this.SignTime = XSingleton<UiUtility>.singleton.GetMachineTime();
this.LeftTime = leftTime;
this.SUMMONLEFTTIME = XSingleton<XGlobalConfig>.singleton.GetInt("GuildCampSummonSpiritTime");
}
public void RefreshTime(object o = null)
{
int num = (int)(XSingleton<UiUtility>.singleton.GetMachineTime() - this.SignTime);
num = (int)(this.LeftTime - (uint)num);
int num2 = num - this.SUMMONLEFTTIME;
bool flag = num < 0;
if (flag)
{
num = 0;
}
bool flag2 = num2 < 0;
if (flag2)
{
num2 = 0;
}
bool flag3 = DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.IsVisible();
if (flag3)
{
DlgBase<XMainInterface, XMainInterfaceBehaviour>.singleton.RefreshGuildCollectTime(num, num2);
}
bool flag4 = DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.IsVisible();
if (flag4)
{
DlgBase<GuildCollectRewardDlg, GuildCollectRewardBehaviour>.singleton.RefreshTime(num);
}
this._hallTimeToken = XSingleton<XTimerMgr>.singleton.SetTimer(1f, new XTimerMgr.ElapsedEventHandler(this.RefreshTime), null);
}
}
}
|