yyl
昨天 5d3366f2e0f687995eb7ad2107c4379fe7acd4e8
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
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
1070
1071
1072
1073
1074
1075
1076
1077
1078
1079
1080
1081
1082
1083
1084
1085
1086
1087
1088
1089
1090
1091
1092
1093
1094
1095
1096
1097
1098
1099
1100
1101
1102
1103
1104
1105
1106
1107
1108
1109
1110
1111
1112
1113
1114
1115
1116
1117
1118
1119
1120
1121
1122
1123
1124
1125
1126
1127
1128
1129
1130
1131
1132
1133
1134
1135
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
 
public class OperationTimeHepler : Singleton<OperationTimeHepler>
{
    public Dictionary<Operation, OperationBase> operationDict = new Dictionary<Operation, OperationBase>();
 
    public static StringBuilder textBuilder = new StringBuilder();
 
    public event Action<Operation> operationTimeUpdateEvent;
    public event Action<Operation> operationServerCloseEvent;//特殊情况下触发
    public event Action<Operation, int> operationEndEvent;//活动结束时间触发  第二个参数0--过活动时间触发  1--过活动天触发
    public event Action<Operation, int> operationStartEvent;//活动开始时间并且满足开启条件触发 第二个参数0--活动时间触发  1--活动天触发
    public event Action<int> dayResetEvent;//活动重置事件0-0点 1-5点
    public event Action<Operation> operationAdvanceEvent;//活动在提前开启的时间内
 
    public OperationTimeHepler()
    {
        DTC0102_tagCDBPlayer.beforePlayerDataInitializeEvent += BeforePlayerDataInitializeEvent;
        GlobalTimeEvent.Instance.secondEvent += SecondEvent;
        TimeMgr.Instance.OnHourEvent += HourEvent;
    }
 
    private void BeforePlayerDataInitializeEvent()
    {
        operationDict.Clear();
    }
 
    private void SecondEvent()
    {
        if (!ConfigManager.Instance.isLoadFinished)
            return;
 
        if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin)
        {
            return;
        }
        for (int i = 0; i < (int)Operation.max; i++)
        {
            if (operationDict.ContainsKey((Operation)i))
            {
                var operation = operationDict[(Operation)i];
                if (!operation.inDateNotify && operation.SatisfyOpenCondition()
                    && operation.InDay(TimeUtility.ServerNow))
                {
                    operation.inDateNotify = true;
                    operation.stepDateNotify = false;
                    Debug.LogFormat("{0}  活动天开始", (Operation)i);
                    if (operationStartEvent != null)
                    {
                        operationStartEvent((Operation)i, 1);
                    }
                }
                else if (!operation.stepDateNotify && !operation.InDay(TimeUtility.ServerNow))
                {
                    operation.inDateNotify = false;
                    operation.stepDateNotify = true;
                    Debug.LogFormat("{0}  活动天结束", (Operation)i);
                    if (operationEndEvent != null)
                    {
                        operationEndEvent((Operation)i, 1);
                    }
                }
                if (!operation.inTimeNotify && operation.SatisfyOpenCondition()
                    && operation.InTime(TimeUtility.ServerNow))
                {
                    operation.inTimeNotify = true;
                    operation.stepTimeNotify = false;
                    Debug.LogFormat("{0}  活动时间开始", (Operation)i);
                    if (operationStartEvent != null)
                    {
                        operationStartEvent((Operation)i, 0);
                    }
                }
                else if (!operation.stepTimeNotify && !operation.InTime(TimeUtility.ServerNow))
                {
                    operation.inTimeNotify = false;
                    operation.stepTimeNotify = true;
                    operation.inAdvanceNotify = false;
                    Debug.LogFormat("{0}  活动时间结束", (Operation)i);
                    if (operationEndEvent != null)
                    {
                        operationEndEvent((Operation)i, 0);
                    }
                }
 
                if (!operation.inAdvanceNotify && operation.SatisfyOpenCondition()
                    && operation.InAdvanceTime(TimeUtility.ServerNow))
                {
                    operation.inAdvanceNotify = true;
                    Debug.LogFormat("{0}  活动提前开启", (Operation)i);
                    if (operationAdvanceEvent != null)
                    {
                        operationAdvanceEvent((Operation)i);
                    }
                }
            }
        }
    }
 
    private void HourEvent()
    {
        if (!DTC0403_tagPlayerLoginLoadOK.finishedLogin)
        {
            return;
        }
        if (TimeUtility.Hour == 0 && dayResetEvent != null)
        {
            dayResetEvent(0);
        }
        if (TimeUtility.Hour == 5 && dayResetEvent != null)
        {
            dayResetEvent(1);
        }
    }
 
    
 
    // /// <summary>
    // /// 累计充值
    // /// </summary>
    // /// <param name="package"></param>
 
    // public void UpdateAccumulateRecharge(HAA1D_tagMCActTotalRechargeInfo package)
    // {
    //     OperationBase operationBase = null;
 
    //     Operation opreationType = Operation.AccumulateRecharge;
    //     if (package.ActNum == 10)
    //     {
    //         //精彩活动-单日累充
    //         opreationType = Operation.AccumulateRecharge;
    //     }
    //     else if (package.ActNum == 11)
    //     {
    //         //精彩活动-多日累充
    //         opreationType = Operation.DaysAccumulateRecharge;
    //     }
    //     else if (package.ActNum == 20)
    //     {
    //         //合服-福利(多日累充1档)
    //         opreationType = Operation.default8;
    //     }
    //     else if (package.ActNum == 30)
    //     {
    //         //节日-单日累充
    //         opreationType = Operation.HolidayAccumulateRecharge;
    //     }
    //     else if (package.ActNum == 31)
    //     {
    //         //节日-多日累充
    //         opreationType = Operation.HolidayMultiRecharge;
    //     }
    //     else if (package.ActNum == 34)
    //     {
    //         // 节日-指定1档充值
    //         opreationType = Operation.default20;
    //     }
    //     else if (package.ActNum == 35)
    //     {
    //         // 福缘- 长久累充(几个月或更长)
    //         opreationType = Operation.default32;
    //     }
 
    //     operationDict.TryGetValue(opreationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(opreationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationAccumulateRecharge();
    //             operationDict.Add(opreationType, operationBase);
    //         }
    //         OperationAccumulateRecharge operation = operationBase as OperationAccumulateRecharge;
    //         operation.Reset();
    //         operation.limitLv = package.LimitLV;
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.ParseAccumulateRecharge(package);
    //         operation.ActNum = package.ActNum;
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(opreationType);
    //         }
    //     }
    // }
 
    
 
    // public void UpdateCollectWordsPackage(HAA40_tagMCActCollectWordsInfo package)
    // {
    //     OperationBase operationBase = null;
 
    //     var opreationType = Operation.CollectWords;
 
    //     switch (package.ActNum)
    //     {
    //         case 10:
    //             opreationType = Operation.CollectWords;
    //             break;
    //         case 20:
    //             opreationType = Operation.default10;
    //             break;
    //         case 30:
    //             opreationType = Operation.HolidayCollectWords;
    //             break;
    //     }
 
    //     operationDict.TryGetValue(opreationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(opreationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationCollectWords();
    //             operationDict.Add(opreationType, operationBase);
    //         }
    //         OperationCollectWords operation = operationBase as OperationCollectWords;
    //         operation.Reset();
    //         operation.limitLv = package.LimitLV;
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.ActNum = package.ActNum;
    //         operation.LastDayOnlyExchange = package.LastDayOnlyExchange;
    //         operation.ParseCollectWords(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(opreationType);
    //         }
    //     }
    // }
 
    // public void UpdateSingleRechargeInfo(HAA50_tagMCActSingleRechargeInfo package)
    // {
    //     OperationBase operationBase = null;
 
    //     var opreationType = Operation.default28;
 
    //     operationDict.TryGetValue(opreationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(opreationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationSingleRecharge();
    //             operationDict.Add(opreationType, operationBase);
    //         }
    //         OperationSingleRecharge operation = operationBase as OperationSingleRecharge;
    //         operation.Reset();
    //         operation.limitLv = package.LimitLV;
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.ActNum = package.ActNum;
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.ParseSingleRecharge(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(opreationType);
    //         }
    //     }
    // }
 
    // public void UpdateHolidayLogin(HAA42_tagMCFeastLoginInfo package)
    // {
    //     OperationBase operationBase = null;
    //     operationDict.TryGetValue(Operation.HolidayLogin, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(Operation.HolidayLogin);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationHolidayLogin();
    //             operationDict.Add(Operation.HolidayLogin, operationBase);
    //         }
    //         var operation = operationBase as OperationHolidayLogin;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.limitLv = package.LimitLV;
    //         operation.ParsePackage(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(Operation.HolidayLogin);
    //         }
    //     }
    // }
 
    
 
    // public void UpdateMultiRechargePackage(HAA27_tagMCActRechargePrizeInfo package)
    // {
    //     OperationBase operationBase = null;
    //     operationDict.TryGetValue(Operation.MultiRecharge, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(Operation.MultiRecharge);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationMultiRecharge();
    //             operationDict.Add(Operation.MultiRecharge, operationBase);
    //         }
    //         OperationMultiRecharge operation = operationBase as OperationMultiRecharge;
    //         operation.Reset();
    //         operation.limitLv = package.LimitLV;
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.ParseMultiRecharge(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(Operation.MultiRecharge);
    //         }
    //     }
    // }
 
    // /// <summary>
    // /// 限时礼包
    // /// </summary>
    // /// <param name="package"></param>
 
    // public void UpdateGiftPackage(HAA12_tagMCFlashGiftbagInfo package)
    // {
    //     OperationBase operationBase = null;
    //     Operation operationType = Operation.GiftPackage;
 
    //     switch (package.ActNum)
    //     {
    //         case 10:
    //             operationType = Operation.GiftPackage;
    //             break;
    //         case 20:
    //             operationType = Operation.default13;
    //             break;
    //         case 30:
    //             operationType = Operation.HolidayGiftPackage;
    //             break;
    //     }
 
    //     operationDict.TryGetValue(operationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(operationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new GiftPackageClass();
    //             operationDict.Add(operationType, operationBase);
    //         }
    //         GiftPackageClass operation = operationBase as GiftPackageClass;
    //         operation.Reset();
    //         operation.limitLv = package.LimitLV;
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.inAdvanceMinute = package.AdvanceMinutes;
    //         operation.ActNum = package.ActNum;
    //         for (int i = 0; i < package.ActivityTimeCount; i++)
    //         {
    //             operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
    //                 package.ActivityTime[i].EndtTime));
    //         }
    //         operation.ParsePackage(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(operationType);
    //         }
    //     }
    // }
 
   
  
    
 
    // public void UpdateCrossActLianQiInfo(HAA90_tagMCCrossActLianqiInfo package)
    // {
    //     OperationBase operationBase = null;
    //     operationDict.TryGetValue(Operation.default51, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(Operation.default51);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationLianQiCross();
    //             operationDict.Add(Operation.default51, operationBase);
    //         }
    //         OperationLianQiCross operation = operationBase as OperationLianQiCross;
    //         operation.Reset();
    //         operation.m_ServerListStr = UIHelper.GetServers(package.ServerIDRangeInfo);
    //         operation.m_GroupValue1 = package.GroupValue1;
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.dayReset = true;
    //         operation.limitLv = package.LimitLV;
    //         operation.ParseJoinTime(package.JoinStartTime, package.JoinEndTime);
    //         operation.ParseCrossActHorsePetTrainInfo(package);
    //         //for (int i = 0; i < package.ActivityTimeCount; i++)
    //         //{
    //         //    operation.times.Add(ParseOperationTime(package.ActivityTime[i].StartTime,
    //         //        package.ActivityTime[i].EndtTime));
    //         //}
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(Operation.default51);
    //         }
    //     }
    // }
 
    // public void UpdateActLunhuidianInfo(HAA88_tagMCActLunhuidianInfo package)
    // {
    //     OperationBase operationBase = null;
    //     operationDict.TryGetValue(Operation.default47, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(Operation.default47);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationCycleHall();
    //             operationDict.Add(Operation.default47, operationBase);
    //         }
    //         OperationCycleHall operation = operationBase as OperationCycleHall;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.resetType = package.ResetType;
    //         operation.limitLv = package.LimitLV;
    //         operation.ParseCycleHallInfo(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(Operation.default47);
    //         }
    //     }
    // }
 
    // public void UpdateActYunShiInfo(HAA87_tagMCActYunshiInfo package)
    // {
    //     Operation operationType = Operation.default48;
 
    //     switch (package.ActNum)
    //     {
    //         case 10:
    //             operationType = Operation.default48;
    //             break;
    //     }
    //     OperationBase operationBase = null;
    //     operationDict.TryGetValue(operationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(operationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationYunShi();
    //             operationDict.Add(operationType, operationBase);
    //         }
    //         OperationYunShi operation = operationBase as OperationYunShi;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.resetType = package.ResetType;
    //         operation.limitLv = package.LimitLV;
    //         operation.treasureType = package.TreasureType;
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(operationType);
    //         }
    //     }
    // }
 
    
    // public void UpdateLoginAct(HAA69_tagMCActLoginNew package)
    // {
    //     OperationBase operationBase = null;
    //     Operation operationType = Operation.default29;
 
    //     switch (package.ActNum)
    //     {
    //         case 11:
    //             operationType = Operation.default44;
    //             break;
    //         case 30:
    //             operationType = Operation.default29;
    //             break;
    //     }
 
    //     operationDict.TryGetValue(operationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(operationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationLoginAct();
    //             operationDict.Add(operationType, operationBase);
    //         }
    //         var operation = operationBase as OperationLoginAct;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.limitLv = package.LimitLV;
    //         operation.ActNum = package.ActNum;
    //         operation.ParsePackage(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(operationType);
    //         }
    //     }
    // }
 
    // public void UpdateMissionAct(HAA71_tagMCActTaskInfo package)
    // {
    //     OperationBase operationBase = null;
 
    //     var opreationType = Operation.default30;
    //     switch (package.ActNum)
    //     {
    //         case 11:
    //             opreationType = Operation.default45;
    //             break;
    //         case 12:
    //             opreationType = Operation.default49;
    //             break;
    //         case 30:
    //             opreationType = Operation.default30;
    //             break;
    //     }
    //     operationDict.TryGetValue(opreationType, out operationBase);
 
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(opreationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationMissionAct();
    //             operationDict.Add(opreationType, operationBase);
    //         }
    //         var operation = operationBase as OperationMissionAct;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.limitLv = package.LimitLV;
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.resetType = package.ResetType;
    //         operation.ActNum = package.ActNum;
    //         operation.ParsePackage(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(Operation.default30);
    //         }
    //     }
    // }
 
    // public void UpdateRechargeGiftAct(HAA74_tagMCActBuyCountGiftInfo package)
    // {
    //     OperationBase operationBase = null;
 
    //     Operation operationType = Operation.default31;
 
    //     switch (package.ActNum)
    //     {
    //         case 30:
    //             operationType = Operation.default31;
    //             break;
    //         case 10:
    //             operationType = Operation.default35;
    //             break;
    //         case 31:
    //             operationType = Operation.default38;
    //             break;
    //         case 11:
    //             operationType = Operation.default46;
    //             break;
    //         case 12:
    //             operationType = Operation.default50;
    //             break;
    //         case 13:
    //             operationType = Operation.default52;
    //             break;
    //         default:
    //             return;
    //     }
    //     operationDict.TryGetValue(operationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(operationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationRechargeGiftAct();
    //             operationDict.Add(operationType, operationBase);
    //         }
    //         var operation = operationBase as OperationRechargeGiftAct;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.limitLv = package.LimitLV;
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.resetType = package.ResetType;
    //         operation.ActNum = package.ActNum;
    //         operation.ParsePackage(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(operationType);
    //         }
    //     }
    // }
 
    // public void UpdateActFamilyCTGAssistInfo(HAA77_tagMCActFamilyCTGAssistInfo package)
    // {
    //     OperationBase operationBase = null;
 
    //     Operation operationType = Operation.default34;
 
    //     switch (package.ActNum)
    //     {
    //         case 30:
    //             operationType = Operation.default34;
    //             break;
    //         case 32:
    //             operationType = Operation.default54;
    //             break;
    //         default:
    //             return;
    //     }
    //     operationDict.TryGetValue(operationType, out operationBase);
    //     if (string.IsNullOrEmpty(package.StartDate) || string.IsNullOrEmpty(package.EndtDate))
    //     {
    //         ForceStopOperation(operationType);
    //     }
    //     else
    //     {
    //         if (operationBase == null)
    //         {
    //             operationBase = new OperationFamilyRechargeConn();
    //             operationDict.Add(operationType, operationBase);
    //         }
    //         var operation = operationBase as OperationFamilyRechargeConn;
    //         operation.Reset();
    //         operation.startDate = ParseOperationDate(package.StartDate);
    //         operation.endDate = ParseOperationDate(package.EndtDate);
    //         operation.limitLv = package.LimitLV;
    //         operation.dayReset = package.IsDayReset == 1;
    //         operation.ActNum = package.ActNum;
    //         operation.ParseActFamilyCTGAssistInfo(package);
    //         if (operationTimeUpdateEvent != null)
    //         {
    //             operationTimeUpdateEvent(operationType);
    //         }
    //     }
    // }
 
    public void ForceStopOperation(Operation operationType)
    {
        if (operationDict.ContainsKey(operationType))
        {
            operationDict.Remove(operationType);
        }
        if (operationServerCloseEvent != null)
        {
            operationServerCloseEvent(operationType);
        }
        if (operationEndEvent != null)
        {
            operationEndEvent(operationType, 0);
            operationEndEvent(operationType, 1);
        }
    }
 
    public bool TryGetOperationTime(Operation type, out OperationBase operation)
    {
        return operationDict.TryGetValue(type, out operation);
    }
 
    public bool TryGetOperation<T>(Operation type, out T operation) where T : OperationBase
    {
        operation = null;
        if (operationDict.ContainsKey(type))
        {
            operation = operationDict[type] as T;
            return operation is T;
        }
        return false;
    }
 
    public bool InOperationTime(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.InTime(TimeUtility.ServerNow);
        }
        return false;
    }
 
    public bool InOperationTime(Operation type, DateTime time)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.InTime(time);
        }
        return false;
    }
 
    public bool InOperationJoinTime(Operation type, DateTime time)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.InJoinTime(time);
        }
        return false;
    }
 
    public bool InOperationDay(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.InDay(TimeUtility.ServerNow);
        }
        return false;
    }
 
    public int GetOperationSurplusTime(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.GetSurplusTime(TimeUtility.ServerNow);
        }
        return 0;
    }
 
    public bool InOperationAdvance(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.InAdvanceTime(TimeUtility.ServerNow);
        }
        return false;
    }
 
    public int GetOperationSecondsBeforeStart(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.GetSecondsBeforeStart(TimeUtility.ServerNow);
        }
        return 0;
    }
 
    public bool SatisfyOpenCondition(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.SatisfyOpenCondition() && InOperationTime(type);
        }
        return false;
    }
 
    public bool SatisfyOpenCondition(Operation type, DateTime time)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.SatisfyOpenCondition() && InOperationTime(type, time);
        }
        return false;
    }
 
    //活动开启中,有参与进行时间段
    public bool SatisfyJoinCondition(Operation type, DateTime time)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return InOperationJoinTime(type, time);
        }
        return false;
    }
 
    public bool IsPrepareTime(Operation type, DateTime time)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.IsPrepareTime(time);
        }
        return false;
    }
 
    public bool SatisfyAdvanceCondition(Operation type)
    {
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            return operation.SatisfyOpenCondition() && InOperationAdvance(type);
        }
        return false;
    }
 
    public void ProcessConditionError(Operation type)
    {
        if (SatisfyOpenCondition(type))
        {
            return;
        }
        OperationBase operation;
        if (TryGetOperationTime(type, out operation))
        {
            if (!InOperationTime(type))
            {
                SysNotifyMgr.Instance.ShowTip("InOperationTimeError");
            }
            else if (!operation.SatisfyOpenCondition())
            {
                SysNotifyMgr.Instance.ShowTip(StringUtility.Contact("OperationLevelLimit_", type), operation.limitLv);
            }
        }
        else
        {
            SysNotifyMgr.Instance.ShowTip("InOperationTimeError");
        }
    }
 
    public OperationDate ParseOperationDate(string date)
    {
        string[] dateArray = date.Split('-');
        if (dateArray != null && dateArray.Length == 3)
        {
            return new OperationDate()
            {
                year = int.Parse(dateArray[0].Trim()),
                month = int.Parse(dateArray[1].Trim()),
                day = int.Parse(dateArray[2].Trim())
            };
        }
        //else if (dateArray != null && dateArray.Length == 1)
        //{
        //    var time = TimeUtility.openServerTime;
        //    if (time.Equals(default(DateTime)))
        //    {
        //        Debug.Log("服务期开服时间下发顺序有问题");
        //    }
        //    var days = 0;
        //    int.TryParse(date, out days);
        //    days = Mathf.Max(1, days);
        //    time = time.AddDays(days - 1);
        //    return new OperationDate()
        //    {
        //        year = time.Year,
        //        month = time.Month,
        //        day = time.Day,
        //    };
        //}
        return default(OperationDate);
    }
 
    private OperationTime ParseOperationTime(string startTime, string endTime)
    {
        var startTimeArray = startTime.Split(':');
        var endTimeArray = endTime.Split(':');
        if (startTimeArray != null && startTimeArray.Length == 2
            && endTimeArray != null && endTimeArray.Length == 2)
        {
            return new OperationTime()
            {
                startHour = int.Parse(startTimeArray[0].Trim()),
                startMinute = int.Parse(startTimeArray[1].Trim()),
                endHour = int.Parse(endTimeArray[0].Trim()),
                endMinute = int.Parse(endTimeArray[1].Trim()),
            };
        }
        return default(OperationTime);
    }
}
 
public struct OperationDate
{
    public int year;
    public int month;
    public int day;
 
    public static bool operator ==(OperationDate x, OperationDate y)
    {
        return x.year == y.year && x.month == y.month && x.day == y.day;
    }
 
    public static bool operator !=(OperationDate x, OperationDate y)
    {
        return !(x == y);
    }
 
    public static bool operator >(OperationDate x, OperationDate y)
    {
        if (x.year > y.year)
        {
            return true;
        }
        if (x.year == y.year)
        {
            if (x.month > y.month)
            {
                return true;
            }
            if (x.month == y.month)
            {
                return x.day > y.day;
            }
        }
        return false;
    }
 
    public static bool operator <(OperationDate x, OperationDate y)
    {
        return !(x > y) && x != y;
    }
 
    public static bool operator >=(OperationDate x, OperationDate y)
    {
        return x > y || x == y;
    }
 
    public static bool operator <=(OperationDate x, OperationDate y)
    {
        return x < y || x == y;
    }
 
    public DateTime AddSeconds(int _seconds)
    {
        DateTime d = new DateTime(year, month, day);
        return d.AddTicks(_seconds * TimeSpan.TicksPerSecond);
    }
 
    public OperationDate AddDays(int _days)
    {
        DateTime d = new DateTime(year, month, day);
        d = d.AddTicks(_days * TimeSpan.TicksPerDay);
        return new OperationDate()
        {
            year = d.Year,
            month = d.Month,
            day = d.Day,
        };
    }
 
    public string ToDisplay(bool showYear = true)
    {
        if (showYear)
        {
            return StringUtility.Contact(year, "/", month, "/", day);
        }
 
        return StringUtility.Contact(month, "/", day);
 
        //var yearString = StringUtility.Contact(year, Language.Get("Year"));
        //return StringUtility.Contact(showYear ? yearString : string.Empty, month, Language.Get("Month"), day, Language.Get("Day"));
    }
 
    public static int operator -(OperationDate x, OperationDate y)
    {
        DateTime _x = new DateTime(x.year, x.month, x.day);
        DateTime _y = new DateTime(y.year, y.month, y.day);
        return (int)(_x - _y).TotalDays;
    }
}
 
public struct OperationTime
{
    public int startHour;
    public int startMinute;
 
    public int endHour;
    public int endMinute;
 
    public bool InTime(DateTime time)
    {
        return CompareTime(time) == 0;
    }
 
    public int CompareTime(DateTime time)
    {
        if (time.Hour < startHour || (time.Hour == startHour && time.Minute < startMinute))
        {
            return -1;
        }
        if (time.Hour > endHour || (time.Hour == endHour && time.Minute >= endMinute))
        {
            return 1;
        }
        return 0;
    }
 
    public override string ToString()
    {
        return StringUtility.Contact(startHour.ToString("D2"), ":", startMinute.ToString("D2"),
            "-", endHour.ToString("D2"), ":", endMinute.ToString("D2"));
    }
 
    public static int operator -(OperationTime x, DateTime y)
    {
        DateTime d = new DateTime(y.Year, y.Month, y.Day, x.endHour, x.endMinute, 0);
        return Mathf.Max(0, (int)(d - y).TotalSeconds);
    }
}
 
public enum Operation
{
    MultipleExp,
    ConsumeRebate,
    FlashSale,//限时特惠
    BossReborn,
    GiftPackage,
    FairyCeremony, //仙界盛典
    MultipRealmPoint, //N倍修行点
    FlashRushToBuy, //限时抢购
    WishingWellInfo, //许愿池
    AccumulateRecharge,//累计充值,单日
    LoginReward,//登录奖励
    FestivalRedpack,//节日红包
    NewYearFairyCeremony, //春节仙界盛典
    SpringFestival,//春节巡礼
    OpenServiceAchievement,//七日巡礼
    LuckyTreasure,//幸运鉴宝
    MultiRecharge, //仙玉充值返利 (首充双倍)
    CZBMGift,   // 成长必买礼包
    DaysAccumulateRecharge, //累计充值,多日
    CollectWords,   //收集文字
    HolidayLogin,   //节日登录
    HolidayWish,   //节日祝福灯笼
    HolidayMultiRecharge,//节日祝福的多日累计充值 包含任意充值界面和多日累充界面
    HolidayTravel,      //节日游历
    HolidayAccumulateRecharge, //节日-单日的累积充值
    HolidayCollectWords, //节日-集字
    HolidayGiftPackage, //节日祝福-限时礼包
    HolidayFlashRushToBuy, //节日-限时抢购
    HolidayFlashSale, //节日祝福-限时特惠
    HolidayConsumeRebate, //节日祝福-消费返利
 
    //后续IL开发添加预设
    default1,   // 连续多日累充
    default2,
    default3,   // 节日-垃圾分类
    default4,   // 节日-翻牌
    default5,
    default6,
    default7,   // 精彩活动-跨服充值
    default8,   // 合服-福利(多日累充1档)
    default9,   // 合服-转盘
    default10,  // 合服-集字狂欢
    default11,  // 合服-坐骑盛宴
    default12,  // 合服-超值限购
    default13,  // 合服-限时礼包
    default14,
    default15,
    default16,
    default17,
    default18,  // 幸运云购
    default19,
    default20,  //节日指定累计充值额度,和节日任意充值独立两个界面
    default21,
    default22,  //天帝礼包
    default23,
    default24,
    default25,  //买1送5
    default26,
    default27,  //日期型活动- boss历练活动
    default28,  //精彩活动-单笔充值
    default29,  //日期型活动- 登录,可补签
    default30,  //日期型活动- 任务
    default31,  //日期型活动- 礼包,可累计购买次数领取
    default32,  //福缘- 长久累充(几个月或更长) 独立界面
    default33,  //日期型活动- boss 历练活动(跨服) 必须和活动default27一起使用
    default34,  //日期型活动- 仙盟充值互助,特殊:允许多个活动同时开启
    default35,  //自选礼包
    default36,  //日期型活动- 秘境寻宝(类仙匣) 主活动
    default37,  //日期型活动- 秘境寻宝(类仙匣) 跨服
    default38,  //日期型活动- 自选礼包 + 商店
    default39,  //日期型活动- 骑宠培养本服
    default40,  //日期型活动- 骑宠培养跨服
    default41,  //日期型活动- 古宝养成本服
    default42,  //日期型活动- 古宝养成跨服
    default43,  ////日期型活动- 任务环
    default44,  //日期型活动 - 仙缘登陆,可补签
    default45,  //日期型活动 - 仙缘任务
    default46,  //日期型活动 - 仙缘礼包
    default47,  //日期型活动 - 轮回殿
    default48,  //日期型活动 - 运势寻宝
    default49,  //日期型活动 - 运势任务
    default50,  //日期型活动 - 运势礼包
    default51,  //日期型活动 - 仙匠大会炼器
    default52,  //日期型活动 - 仙匠大会礼包
    default53,  //日期型活动 - 仙盟攻城战 跨服
    default54,  //日期型活动 - 仙盟攻城战仙盟协助和礼包
    max,
}