少年修仙传客户端代码仓库
hch
2024-12-16 9377811d0ba27047e1e5ec2348a28eba1033d59d
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
using System;
using System.Collections;
using System.Collections.Generic;
using System.Text;
using UnityEngine;
namespace vnxbqy.UI
{
    
    public class HazyRegionModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk
    {
        Dictionary<int, Incident> m_Incidents = new Dictionary<int, Incident>();
        Dictionary<int, AdventureInfo> m_AdventureInfos = new Dictionary<int, AdventureInfo>();
 
        public readonly List<HazyRegionIncidentType> incidentTypesSort = new List<HazyRegionIncidentType>()
        {
            HazyRegionIncidentType.Adventure,
            HazyRegionIncidentType.Precious,
            HazyRegionIncidentType.FairyGrass,
            HazyRegionIncidentType.ReikiGrass,
            HazyRegionIncidentType.DemonKing,
        };
 
        public readonly List<IncidentState> incidentSelectSort = new List<IncidentState>()
        {
            IncidentState.Processing,
            IncidentState.UnStart,
            IncidentState.Complete,
        };
 
        public const int PRECIOUS_CLIENTDATAMAP = 31190;
 
        public int limitPoint { get; private set; }
        public int point { get; private set; }
 
        public int processingIncidentId
        {
            get
            {
                return LocalSave.GetInt(StringUtility.Contact("HazyIncidentId", PlayerDatas.Instance.PlayerId));
            }
            private set
            {
                LocalSave.SetInt(StringUtility.Contact("HazyIncidentId", PlayerDatas.Instance.PlayerId), value);
            }
        }
 
        public int adventureDialogueId { get; private set; }
        public bool playing { get; private set; }
        public bool satisfyJiaOpen { get; private set; }
        public int hazyRegionOpenTimes { get; private set; }
        public int jiaOpenTimes { get; private set; }
        public bool isServerPrepare { get; private set; }
        public bool requireIncidentAnimation { get; set; }
        public bool incidentDirty { get; set; }
        public bool auto;
        public int openActviePoint { get; private set; }
        public int autoOpenLimitLevel { get; private set; }
        int autoOpenLimitTimes = 0;
        public int autoOpenLimitLV = 0;
 
        int m_SelectIncident;
        public int selectIncident
        {
            get { return m_SelectIncident; }
            set
            {
                if (m_SelectIncident != value)
                {
                    m_SelectIncident = value;
                    if (selectIncidentRefresh != null)
                    {
                        selectIncidentRefresh();
                    }
                }
            }
        }
 
        public bool InJiaHazyRegion
        {
            get
            {
                return !FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HazyRegion);
            }
        }
 
        public readonly Redpoint redpointBase = new Redpoint(39);
        public readonly Redpoint redpoint = new Redpoint(39, 3901);
        readonly Redpoint entranceRedpoint = new Redpoint(3901, 390101);
        readonly Redpoint incidentRedpoint = new Redpoint(3901, 390102);
 
        int cacheMapId = 0;
 
        public event Action selectIncidentRefresh;
        public event Action<int> onHazyRegionStateRefresh;  //0-结束拜访 1-开始拜访 2-强制刷新
        public event Action onHazyRegionIncidentRefresh;
 
        DungeonModel dungeonModel { get { return ModelCenter.Instance.GetModel<DungeonModel>(); } }
        DailyQuestModel dailyQuestModel { get { return ModelCenter.Instance.GetModel<DailyQuestModel>(); } }
        HazyDemonKingModel hazyDemonKingModel { get { return ModelCenter.Instance.GetModel<HazyDemonKingModel>(); } }
        HazyGrassModel hazyGrassModel { get { return ModelCenter.Instance.GetModel<HazyGrassModel>(); } }
        TaskModel taskModel { get { return ModelCenter.Instance.GetModel<TaskModel>(); } }
        FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
        CrossServerOneVsOneModel crossServerOneVsOneModel { get { return ModelCenter.Instance.GetModel<CrossServerOneVsOneModel>(); } }
 
        public override void Init()
        {
            ParseConfig();
 
            StageLoad.Instance.onStageLoadFinish += OnStageLoadFinish;
            AdventureStage.Instance.onLoadAdventureStage += OnLoadAdventureStage;
            AdventureStage.Instance.onExitAdventureStage += OnExitAdventureStage;
            findPreciousModel.bossInfoUpdateEvent += BossInfoUpdateEvent;
            DailyQuestActionTimer.Instance.RefreshDailyQuestState += RefreshDailyQuestState;
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            isServerPrepare = false;
            point = 0;
            playing = false;
            hazyRegionOpenTimes = 0;
            m_Incidents.Clear();
            m_AdventureInfos.Clear();
        }
 
        public void OnPlayerLoginOk()
        {
            auto = false;//LocalSave.GetBool("HazyRegionAutoSetting" + PlayerDatas.Instance.PlayerId, false);
            isServerPrepare = true;
 
            if (AdventureStage.Instance.IsInAdventureStage)
            {
                ClientDungeonStageUtility.RequestStartClientDungeon(0, 0, (dungeonInfo, isOk) =>
                {
                    if (!isOk)
                    {
                        AdventureStage.Instance.Exit();
                    }
                });
            }
 
            UpdateRedpoint();
        }
 
        public override void UnInit()
        {
            StageLoad.Instance.onStageLoadFinish -= OnStageLoadFinish;
            AdventureStage.Instance.onExitAdventureStage -= OnExitAdventureStage;
            AdventureStage.Instance.onLoadAdventureStage -= OnLoadAdventureStage;
            findPreciousModel.bossInfoUpdateEvent -= BossInfoUpdateEvent;
            DailyQuestActionTimer.Instance.RefreshDailyQuestState -= RefreshDailyQuestState;
        }
 
        private void OnLoadAdventureStage()
        {
            //WindowCenter.Instance.Open<HazyAdventureHintWin>();
            var dialogueConfig = AdventureDialogueConfig.Get(adventureDialogueId);
            BossShowModel.Instance.Start(0, dialogueConfig.npcId);
        }
 
        private void OnExitAdventureStage()
        {
            if (PlayerDatas.Instance.baseData.LV > autoOpenLimitLevel)
            {
                if (hazyRegionOpenTimes > autoOpenLimitTimes || !IsAllIncidentComplete())
                {
                    SnxxzGame.Instance.StartCoroutine(Co_TryOpenHazyRegionWin());
                }
            }
            //WindowCenter.Instance.Close<HazyAdventureHintWin>();
            //taskModel.AutomaticTripToTask(taskModel.currentMission);
        }
 
        private void OnStageLoadFinish()
        {
            if (!(StageLoad.Instance.currentStage is DungeonStage))
            {
                cacheMapId = 0;
            }
            else
            {
                var mapId = PlayerDatas.Instance.baseData.MapID;
                if (!MapUtility.IsDungeon(mapId))
                {
                    if (PlayerDatas.Instance.baseData.LV > autoOpenLimitLevel
                        && IsIncidentDungeon(cacheMapId))
                    {
                        if (hazyRegionOpenTimes > autoOpenLimitTimes || !IsAllIncidentComplete())
                        {
                            SnxxzGame.Instance.StartCoroutine(Co_TryOpenHazyRegionWin());
                        }
                    }
                }
                cacheMapId = mapId;
            }
        }
 
        private void BossInfoUpdateEvent(int obj)
        {
            if (isServerPrepare)
            {
                UpdateRedpoint();
            }
        }
 
        private void RefreshDailyQuestState()
        {
            if (isServerPrepare)
            {
                UpdateRedpoint();
            }
        }
 
 
 
        IEnumerator Co_TryOpenHazyRegionWin()
        {
            yield return WaitingForSecondConst.WaitMS1000;
            if (NewBieCenter.Instance.inGuiding ||
                ModelCenter.Instance.GetModel<TreasureModel>().newGotShowing ||
                InJiaHazyRegion)
            {
                yield break;
            }
            if (WindowCenter.Instance.IsOpen<MainInterfaceWin>())
            {
                WindowCenter.Instance.Open<HazyRegionFrameWin>();
            }
        }
 
        void ParseConfig()
        {
            var funcConfig = FuncConfigConfig.Get("ImmortalDomainStrength");
            limitPoint = int.Parse(funcConfig.Numerical1);
 
            funcConfig = FuncConfigConfig.Get("FakeImmortalCount");
            jiaOpenTimes = int.Parse(funcConfig.Numerical1);
 
            funcConfig = FuncConfigConfig.Get("ImmortalDomainActivePoint");
            openActviePoint = int.Parse(funcConfig.Numerical2);
 
            funcConfig = FuncConfigConfig.Get("HazyRegionAutoOpen");
            autoOpenLimitLevel = int.Parse(funcConfig.Numerical1);
            int.TryParse(funcConfig.Numerical2, out autoOpenLimitTimes);
            int.TryParse(funcConfig.Numerical3, out autoOpenLimitLV);
            
 
        }
 
        public bool TryGetIncident(int id, out Incident incident)
        {
            return m_Incidents.TryGetValue(id, out incident);
        }
 
        public bool TryGotoIncident(int id, bool careDungeon, out int error)
        {
            error = 0;
            var config = HazyRegionConfig.Get(id);
            if (config == null)
            {
                return false;
            }
            var questState = dailyQuestModel.GetQuestState((int)DailyQuestType.HazyRegion);
            if (questState == DailyQuestModel.DailyQuestState.OutTime)
            {
                error = 6;
                return false;
            }
            if (careDungeon && !TryGotoDungeon(id, out error))
            {
                return false;
            }
            if (PlayerDatas.Instance.extersion.bossState == 1)
            {
                error = 7;
                return false;
            }
            Incident incident;
            if (TryGetIncident(id, out incident))
            {
                switch ((HazyRegionIncidentType)config.incidentType)
                {
                    case HazyRegionIncidentType.DemonKing:
                        if (config.dungeonType != 0 && !findPreciousModel.IsBossAlive(config.npcId))
                        {
                            error = 5;
                            return false;
                        }
                        break;
                }
 
                if (incident.state != IncidentState.Processing)
                {
                    switch (incident.state)
                    {
                        case IncidentState.UnStart:
                            //if (point < config.point)
                            //{
                            //    error = 3;
                            //    return false;
                            //}
                            break;
                        case IncidentState.Complete:
                            error = 4;
                            return false;
                    }
                }
            }
            return true;
        }
 
        public bool TryGotoDungeon(int id, out int error)
        {
            error = 0;
            if (CrossServerUtility.IsCrossServer())
            {
                error = 1;
                return false;
            }
            if (crossServerOneVsOneModel.IsMatching)
            {
                error = 8;
                return false;
            }
            var mapId = PlayerDatas.Instance.baseData.MapID;
            if (MapUtility.IsDungeon(mapId))
            {
                error = 2;
                return false;
            }
            if (AdventureStage.Instance.IsInAdventureStage)
            {
                error = 2;
                return false;
            }
            return true;
        }
 
        public bool TryAddTimes()
        {
            var config = DailyQuestConfig.Get((int)DailyQuestType.HazyRegion);
            var dailyQuestOpenTime = DailyQuestOpenTimeConfig.Get(config.RelatedID);
            var limitTimes = dailyQuestOpenTime.DayTimes;
 
            var totalTimes = dailyQuestModel.GetDailyQuestTotalTimes((int)DailyQuestType.HazyRegion);
            var completedTimes = dailyQuestModel.GetDailyQuestCompletedTimes((int)DailyQuestType.HazyRegion);
            var times = Mathf.Clamp(totalTimes - completedTimes, 0, limitTimes);
 
            if (times >= limitTimes)
            {
                return false;
            }
 
            return true;
        }
 
        public bool TryGetAdventureInfo(int id, out AdventureInfo adventureInfo)
        {
            return m_AdventureInfos.TryGetValue(id, out adventureInfo);
        }
 
        public ICollection<int> GetAllIncidents()
        {
            return m_Incidents.Keys;
        }
 
        public int GetIncidentId(int mapId, int lineId)
        {
            var configs = HazyRegionConfig.GetValues();
            foreach (var config in configs)
            {
                if (config.dungeonId == mapId && config.lineId == lineId)
                {
                    return config.id;
                }
            }
            return 0;
        }
 
        public int GetAdventureNpcId()
        {
            var dialogueConfig = AdventureDialogueConfig.Get(adventureDialogueId);
            if (dialogueConfig != null)
            {
                return dialogueConfig.npcId;
            }
            return 0;
        }
 
        public bool IsIncidentDungeon(int mapId)
        {
            if (mapId == 0)
            {
                return false;
            }
            if (mapId == HazyDemonKingModel.CLIENTDATAMAP
                || mapId == HazyGrassModel.FAIRY_CLIENTDATAMAP
                || mapId == HazyGrassModel.REIKI_CLIENTDATAMAP)
            {
                return true;
            }
            var configs = HazyRegionConfig.GetValues();
            foreach (var config in configs)
            {
                if (config.dungeonId == mapId)
                {
                    return true;
                }
            }
            return false;
        }
 
        public bool IsIncidentDungeon()
        {
            if (AdventureStage.Instance.IsInAdventureStage)
            {
                return true;
            }
            if (IsIncidentDungeon(PlayerDatas.Instance.baseData.MapID))
            {
                return true;
            }
            return false;
        }
 
        public bool HasIncidentByMapID(int MapID)
        {
            foreach (var id in m_Incidents.Keys)
            {
                if (HazyRegionConfig.Get(id).dungeonId == MapID)
                {
 
                    Incident incident;
                    TryGetIncident(id, out incident);
                    if (incident.state != IncidentState.Complete)
                        return true;
                }
            }
            return false;
        }
 
        public bool IsAllIncidentComplete()
        {
            var allComplete = true;
            foreach (var id in m_Incidents.Keys)
            {
                Incident incident;
                if (TryGetIncident(id, out incident))
                {
                    if (incident.state != IncidentState.Complete)
                    {
                        allComplete = false;
                        break;
                    }
                }
            }
            return allComplete;
        }
 
        public void DisplayErrorRemind(int error)
        {
            switch (error)
            {
                case 1:
                    SysNotifyMgr.Instance.ShowTip("CrossMap10");
                    break;
                case 2:
                    SysNotifyMgr.Instance.ShowTip("InDungeon_CantGo");
                    break;
                case 3:
                    SysNotifyMgr.Instance.ShowTip("EnterHazyIncidentError_3");
                    break;
                case 4:
                    SysNotifyMgr.Instance.ShowTip("EnterHazyIncidentError_4");
                    break;
                case 5:
                    SysNotifyMgr.Instance.ShowTip("EnterHazyIncidentError_5");
                    break;
                case 6:
                    DailyQuestOpenTime dailyQuestOpenTime;
                    if (dailyQuestModel.TryGetOpenTime((int)DailyQuestType.HazyRegion, out dailyQuestOpenTime))
                    {
                        HourMinute hourMinute;
                        if (dailyQuestOpenTime.TryGetTodayNearestOpenTime(out hourMinute))
                        {
                            SysNotifyMgr.Instance.ShowTip("OpenHazyRegionError_1",
                                hourMinute.hourBegin.ToString("D2"),
                                hourMinute.hourEnd.ToString("D2"));
                        }
                    }
                    break;
                case 7:
                    SysNotifyMgr.Instance.ShowTip("Boss_Leave");
                    break;
                case 8:
                    SysNotifyMgr.Instance.ShowTip("CrossOneVsOneMatching");
                    break;
            }
        }
 
        public void StartAdventureDialogue()
        {
            WindowCenter.Instance.Close<MainInterfaceWin>();
            HazyRegionDialogueWin.adventureDialogueId = adventureDialogueId;
            WindowCenter.Instance.Open<HazyRegionDialogueWin>();
        }
 
        void InitializeAdventure()
        {
            var config = HazyRegionConfig.Get(processingIncidentId);
            if (config != null)
            {
                var gear = 0;
                AdventureInfo adventureInfo;
                if (TryGetAdventureInfo(processingIncidentId, out adventureInfo))
                {
                    switch (config.lineId)
                    {
                        case 1:
                            gear = PlayerDatas.Instance.baseData.LV >= adventureInfo.condition ? adventureInfo.gear : 0;
                            break;
                        case 2:
                            gear = PlayerDatas.Instance.baseData.realmLevel >= adventureInfo.condition ? adventureInfo.gear : 0;
                            break;
                        case 3:
                            gear = PlayerDatas.Instance.baseData.FightPoint >= (ulong)adventureInfo.condition ? adventureInfo.gear : 0;
                            break;
                        case 4:
                            gear = PlayerDatas.Instance.extersion.luckValue >= adventureInfo.condition ? adventureInfo.gear : 0;
                            break;
                    }
                }
                var dialogueConfig = AdventureDialogueConfig.Get(config.lineId, gear);
                if (dialogueConfig != null)
                {
                    adventureDialogueId = dialogueConfig.id;
                }
            }
        }
 
        public void SendGotoIncident(int id)
        {
            processingIncidentId = id;
 
            var config = HazyRegionConfig.Get(id);
            switch ((HazyRegionIncidentType)config.incidentType)
            {
                case HazyRegionIncidentType.Adventure:
                    ClientDungeonStageUtility.RequestStartClientDungeon(0, 0, (dungeonInfo, isOk) =>
                      {
                          InitializeAdventure();
 
                          WindowJumpMgr.Instance.ClearJumpData();
                          WindowCenter.Instance.CloseAll(WindowCenter.CloseAllIgnoreType.BaseAndCustom);
 
                          var hero = PlayerDatas.Instance.hero;
                          if (hero != null)
                          {
                              hero.StopAll();
                          }
 
                          AdventureStage.Instance.Enter();
                          Incident incident;
                          if (TryGetIncident(id, out incident))
                          {
                              if (incident.state == IncidentState.UnStart)
                              {
                                  SendSwitchAdventureState(id, 2);
                              }
                          }
                      });
                    break;
                case HazyRegionIncidentType.DemonKing:
                    if (config.dungeonType == 0)
                    {
                        hazyDemonKingModel.RequestEnterClientDungeon();
                    }
                    else
                    {
                        SendGotoIncidentDungeon(config);
                    }
                    break;
                case HazyRegionIncidentType.FairyGrass:
                case HazyRegionIncidentType.ReikiGrass:
                    if (config.dungeonType == 0)
                    {
                        hazyGrassModel.RequestEnterClientDungeon();
                    }
                    else
                    {
                        SendGotoIncidentDungeon(config);
                    }
                    break;
                case HazyRegionIncidentType.Precious:
                    //BossShowModel.Instance.reqDungeonLineId = 0;
                    //ClientDungeonStageUtility.GotoNormalClientDungeon(config.dungeonId, config.dungeonId, config.lineId);
                    break;
            }
        }
 
        void SendGotoIncidentDungeon(HazyRegionConfig config)
        {
            if (config.dungeonType == 2)
            {
                var pak = new CC105_tagCMEnterCrossServer();
                pak.DataMapID = (uint)config.dungeonId;
                pak.LineID = (ushort)config.lineId;
                GameNetSystem.Instance.SendInfo(pak);
            }
            else
            {
                dungeonModel.SingleChallenge(config.dungeonId, config.lineId);
            }
        }
 
        public void SendBackHazyRegion()
        {
            var pak = new CA526_tagCMVisitFairyDomain();
            pak.Type = 1;
            GameNetSystem.Instance.SendInfo(pak);
        }
 
        public void SendOpenHazyRegion()
        {
            var pak = new CA526_tagCMVisitFairyDomain();
            pak.Type = 0;
            GameNetSystem.Instance.SendInfo(pak);
        }
 
        public void SendSwitchAdventureState(int id, int state)
        {
            var pak = new CA504_tagCMPlayerGetReward();
            pak.RewardType = (byte)GotServerRewardType.Def_RewardType_FairyAdventuresAward;
            pak.DataEx = (uint)id;
            pak.DataExStr = state.ToString();
            pak.DataExStrLen = (byte)Encoding.UTF8.GetBytes(pak.DataExStr).Length;
            GameNetSystem.Instance.SendInfo(pak);
        }
 
        public void ReceivePackage(HA306_tagMCFairyDomainInfo package)
        {
            var preplaying = playing;
 
            playing = package.State == 1;
            if (playing)
            {
                GA_Hero.startAutoHazyRegion = true;
            }
            satisfyJiaOpen = package.State == 2;
 
            hazyRegionOpenTimes = (int)package.VisitCnt;
 
            point = package.Energy;
 
            if (package.IsAll == 1)
            {
                m_Incidents.Clear();
            }
 
            if (package.State != 1)
            {
                hazyGrassModel.DeleteLocalSaveKey();
            }
 
            for (int i = 0; i < package.Count; i++)
            {
                var data = package.InfoList[i];
                m_Incidents[data.EventID] = new Incident()
                {
                    id = data.EventID,
                    state = (IncidentState)data.EventState,
                };
            }
 
            if (onHazyRegionIncidentRefresh != null)
            {
                onHazyRegionIncidentRefresh();
            }
 
            if (isServerPrepare)
            {
                if (preplaying != playing)
                {
                    if (onHazyRegionStateRefresh != null)
                    {
                        onHazyRegionStateRefresh(playing ? 1 : 0);
                    }
                }
            }
            else
            {
                if (onHazyRegionStateRefresh != null)
                {
                    onHazyRegionStateRefresh(2);
                }
            }
 
            if (isServerPrepare)
            {
                UpdateRedpoint();
            }
        }
 
        public void ReceivePackage(HA307_tagMCFairyAdventuresInfo package)
        {
            m_AdventureInfos.Clear();
            for (int i = 0; i < package.Cnt; i++)
            {
                var data = package.InfoList[i];
 
                m_AdventureInfos[data.EventID] = new AdventureInfo()
                {
                    gear = data.Gear,
                    condition = (int)data.Condition,
                };
            }
        }
 
        void UpdateRedpoint()
        {
            var satisfyEntrance = false;
            var satisfyIncident = false;
            if (FuncOpen.Instance.IsFuncOpen((int)FuncOpenEnum.HazyRegion))
            {
                var totalTimes = dailyQuestModel.GetDailyQuestTotalTimes((int)DailyQuestType.HazyRegion);
                var completedTimes = dailyQuestModel.GetDailyQuestCompletedTimes((int)DailyQuestType.HazyRegion);
                satisfyEntrance = totalTimes > completedTimes;
 
                if (playing)
                {
                    var error = 0;
                    foreach (var id in m_Incidents.Keys)
                    {
                        if (TryGotoIncident(id, false, out error))
                        {
                            satisfyIncident = true;
                            break;
                        }
                    }
                }
            }
 
            entranceRedpoint.state = satisfyEntrance ? RedPointState.Simple : RedPointState.None;
            incidentRedpoint.state = satisfyIncident ? RedPointState.Simple : RedPointState.None;
        }
 
        public enum IncidentState
        {
            UnStart = 1,
            Processing = 2,
            Complete = 3,
        }
 
        public struct Incident
        {
            public int id;
            public IncidentState state;
        }
 
        public struct AdventureInfo
        {
            public int gear;
            public int condition;
        }
    }
 
    public enum HazyRegionIncidentType
    {
        Adventure,
        Precious,
        FairyGrass,
        DemonKing,
        ReikiGrass,
    }
}