少年修仙传客户端代码仓库
hch
2025-06-12 204ef05a831c9484e2abc561d27ecbff7c797453
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
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using System.Text.RegularExpressions;
using System;
using System.Linq;
 
namespace vnxbqy.UI
{
    
    public class ImpactRankModel : Model, IBeforePlayerDataInitialize, IPlayerLoginOk, IOpenServerActivity
    {
        readonly List<RankType> s_ImpactRankTypes = new List<RankType>()
        {
             RankType.OpenServerMount,
             RankType.OpenServerStrengthen,
             RankType.OpenServerGem,
             RankType.OpenServerLv,
             RankType.OpenServerRealm,
             RankType.OpenServerFightPower,
             RankType.OpenServerRune,
             RankType.OpenServerGodWeapon,
             RankType.OpenServerRecharge,
             RankType.OpenServerPet,
             RankType.OpenServerReikiPoint,
             RankType.OpenServerStartLevel,
             RankType.OpenServereEquipTrain,
        };
 
        RankModel rankModel { get { return ModelCenter.Instance.GetModel<RankModel>(); } }
 
        public override void Init()
        {
            ParseConfig();
            rankModel.onRankRefresh += OnRefreshRank;
            TimeUtility.OnServerOpenDayRefresh += OnServerOpenDayRefresh;
            FuncOpen.Instance.OnFuncStateChangeEvent += OnFuncStateChangeEvent;
            OpenServerActivityCenter.Instance.Register(0, this);
        }
 
        public override void UnInit()
        {
            rankModel.onRankRefresh -= OnRefreshRank;
            TimeUtility.OnServerOpenDayRefresh -= OnServerOpenDayRefresh;
        }
 
        public void OnBeforePlayerDataInitialize()
        {
            impactAwardGetDict.Clear();
            gotoImpactRankType = 0;
        }
 
        public void OnPlayerLoginOk()
        {
            foreach (var _type in m_Redpoints.Keys)
            {
                if (!IsMissImpactRank(_type) && IsActivityClose(_type) && ContainsActivity(_type))
                {
                    //C1001_tagCWatchBillboard _pak = new C1001_tagCWatchBillboard();
                    //_pak.Type = (byte)GetRankType(_type);
                    //GameNetSystem.Instance.SendInfo(_pak);
                    int rankType = (int)GetRankType(_type);
                    rankModel.ResetQueryParam();
                    rankModel.QueryRankByPage(rankType);
                    rankModel.QueryRankByPage(rankType, watchID: (int)PlayerDatas.Instance.baseData.PlayerID, forceQuery: true);
                }
            }
            UpdateRedpoint();
        }
 
        private void OnFuncStateChangeEvent(int _id)
        {
            if (_id == 125)
            {
                UpdateRedpoint();
                if (onStateUpdate != null)
                {
                    onStateUpdate(0);
                }
                if (inImpactRankUpdate != null)
                {
                    inImpactRankUpdate();
                }
            }
        }
 
        private void OnServerOpenDayRefresh()
        {
            UpdateRedpoint();
            if (inImpactRankUpdate != null)
            {
                inImpactRankUpdate();
            }
        }
 
        private void OnRefreshRank(int type)
        {
            if (s_ImpactRankTypes.Contains((RankType)type))
            {
                foreach (var _type in m_Redpoints.Keys)
                {
                    if ((int)GetRankType(_type) == type)
                    {
                        UpdateRedpoint(_type);
                        break;
                    }
                }
            }
        }
        #region 配置
        public Dictionary<int, List<OSCBillRankAwardConfig>> billRankCfgDict { get; private set; }
        public Dictionary<int, List<RankAwardItem>> billRankAwardDict { get; private set; }
        public Dictionary<int, List<OSCBillTagAwardConfig>> billTagCfgDict { get; private set; }
        public Dictionary<int, List<RankAwardItem>> billTagAwardDict { get; private set; }
        public Dictionary<int, Int2[]> billRankPromotePathDict { get; private set; }
        public Dictionary<int, OSCbillBoardCondition> impactRankTypeOpenDict { get; private set; }
        public Dictionary<int, List<OSCBillTagAwardConfig>> billTagSortCfgDict { get; private set; }
        public List<int> impactRankSorts = new List<int>();
        public int openServerActivityDays { get; private set; }
        public int openServerRankDays { get; private set; }
        public int gotoImpactRankType { get; set; }
        public int viewRankStartIndex;
 
        public List<Int2> GetBillRankPromotePaths(int type)
        {
            if (!billRankPromotePathDict.ContainsKey(type))
            {
                return null;
            }
 
            var paths = billRankPromotePathDict[type];
            var filtratePaths = new List<Int2>();
            foreach (var path in paths)
            {
                if (PlayerDatas.Instance.baseData.VIPLv >= path.y)
                {
                    filtratePaths.Add(path);
                }
            }
 
            return filtratePaths;
        }
 
        private void ParseConfig()
        {
            billRankCfgDict = new Dictionary<int, List<OSCBillRankAwardConfig>>();
            billRankAwardDict = new Dictionary<int, List<RankAwardItem>>();
            billTagCfgDict = new Dictionary<int, List<OSCBillTagAwardConfig>>();
            billTagSortCfgDict = new Dictionary<int, List<OSCBillTagAwardConfig>>();
            billTagAwardDict = new Dictionary<int, List<RankAwardItem>>();
            var _cfgs = OSCBillRankAwardConfig.GetValues();
            for (int i = 0; i < _cfgs.Count; i++)
            {
                List<OSCBillRankAwardConfig> _list = null;
                billRankCfgDict.TryGetValue(_cfgs[i].RangListType, out _list);
                if (_list == null)
                {
                    _list = new List<OSCBillRankAwardConfig>();
                    billRankCfgDict.Add(_cfgs[i].RangListType, _list);
                }
                _list.Add(_cfgs[i]);
                List<RankAwardItem> _awardList = null;
                billRankAwardDict.TryGetValue(_cfgs[i].RangListType, out _awardList);
                if (_awardList == null)
                {
                    _awardList = new List<RankAwardItem>();
                    billRankAwardDict.Add(_cfgs[i].RangListType, _awardList);
                }
                RankAwardItem _award = new RankAwardItem();
                var _jsonData = LitJson.JsonMapper.ToObject(_cfgs[i].Gift);
                foreach (string _key in _jsonData.Keys)
                {
                    var _job = int.Parse(_key);
                    var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[_key].ToJson());
                    for (int j = 0; j < _itemArray.Length; j++)
                    {
                        _award.Add(_job, new Item(_itemArray[j][0], _itemArray[j][1]));
                    }
                }
                _awardList.Add(_award);
            }
            var _billTagCfgs = OSCBillTagAwardConfig.GetValues();
            for (int i = 0; i < _billTagCfgs.Count; i++)
            {
                List<OSCBillTagAwardConfig> _list = null;
                billTagCfgDict.TryGetValue(_billTagCfgs[i].RangListType, out _list);
                if (_list == null)
                {
                    _list = new List<OSCBillTagAwardConfig>();
                    billTagCfgDict.Add(_billTagCfgs[i].RangListType, _list);
                }
                _list.Add(_billTagCfgs[i]);
 
                List<OSCBillTagAwardConfig> _sortlist = null;
                billTagSortCfgDict.TryGetValue(_billTagCfgs[i].RangListType, out _sortlist);
                if (_sortlist == null)
                {
                    _sortlist = new List<OSCBillTagAwardConfig>();
                    billTagSortCfgDict.Add(_billTagCfgs[i].RangListType, _sortlist);
                }
                _sortlist.Add(_billTagCfgs[i]);
            }
            foreach (var _list in billTagSortCfgDict.Values)
            {
                _list.Sort(Compare);
            }
            foreach (var _type in billTagCfgDict.Keys)
            {
                List<RankAwardItem> _awardList = new List<RankAwardItem>();
                billTagAwardDict.Add(_type, _awardList);
                for (int i = 0; i < billTagCfgDict[_type].Count; i++)
                {
                    RankAwardItem _award = new RankAwardItem();
                    var _jsonData = LitJson.JsonMapper.ToObject(billTagCfgDict[_type][i].Gift);
                    foreach (string _key in _jsonData.Keys)
                    {
                        var _job = int.Parse(_key);
                        var _itemArray = LitJson.JsonMapper.ToObject<int[][]>(_jsonData[_key].ToJson());
                        for (int j = 0; j < _itemArray.Length; j++)
                        {
                            _award.Add(_job, new Item(_itemArray[j][0], _itemArray[j][1]));
                        }
                    }
                    _awardList.Add(_award);
                }
            }
 
            billRankPromotePathDict = new Dictionary<int, Int2[]>();
            var _funcCfg = FuncConfigConfig.Get("OSCBillRankTypePromote");
            var _json = LitJson.JsonMapper.ToObject(_funcCfg.Numerical1);
            foreach (var _key in _json.Keys)
            {
                var _type = int.Parse(_key);
                var subJson = _json[_key];
 
                billRankPromotePathDict[_type] = new Int2[subJson.Keys.Count];
                var index = 0;
                foreach (var subKey in subJson.Keys)
                {
                    var path = int.Parse(subKey);
                    var vipLevel = int.Parse(subJson[subKey].ToString());
                    billRankPromotePathDict[_type][index] = new Int2(path, vipLevel);
                    index++;
                }
            }
 
            _funcCfg = FuncConfigConfig.Get("OSCBillboardOpen");
            _json = LitJson.JsonMapper.ToObject(_funcCfg.Numerical1);
            openServerActivityDays = int.Parse(_funcCfg.Numerical2);
            impactRankTypeOpenDict = new Dictionary<int, OSCbillBoardCondition>();
            openServerRankDays = 0;
            foreach (var _key in _json.Keys)
            {
                var _type = int.Parse(_key);
                var _array = LitJson.JsonMapper.ToObject<int[]>(_json[_key].ToJson());
                OSCbillBoardCondition _condition = new OSCbillBoardCondition()
                {
                    limit = _array[0],
                    start = _array[1],
                    end = _array[2]
                };
                if (_condition.end > openServerRankDays)
                {
                    openServerRankDays = _condition.end;
                }
                impactRankTypeOpenDict.Add(_type, _condition);
                m_Redpoints.Add(_type, new Redpoint(Redpoint_Key_ImpactRank, Redpoint_Key_ImpactRank * 100 + _type));
                impactRankSorts.Add(_type);
            }
        }
 
        private int Compare(OSCBillTagAwardConfig x, OSCBillTagAwardConfig y)
        {
            return x.Condition.CompareTo(y.Condition);
        }
 
        public ImpactRankAwardType GetAwardType(int _type, int _index)
        {
            if (_index >= billRankCfgDict[_type].Count)
            {
                return ImpactRankAwardType.Target;
            }
            return ImpactRankAwardType.Rank;
        }
 
        public OSCBillRankAwardConfig GetRankAwardConfig(int _type, int _index)
        {
            return billRankCfgDict[_type][_index];
        }
 
        public OSCBillTagAwardConfig GetTagAwardConfig(int _type, int _index)
        {
            _index = _index - billRankCfgDict[_type].Count;
            return billTagCfgDict[_type][_index];
        }
 
        public RankAwardItem GetBillAward(int _type, int _index)
        {
            if (_index >= billRankAwardDict[_type].Count)
            {
                return billTagAwardDict[_type][_index - billRankAwardDict[_type].Count];
            }
            return billRankAwardDict[_type][_index];
        }
 
        public int GetBillIndex(int _type, int _index)
        {
            if (_index >= billRankAwardDict[_type].Count)
            {
                return _index - billRankAwardDict[_type].Count;
            }
            return _index;
        }
 
        public int GetTagIndex(int _type, int _index)
        {
            return billTagSortCfgDict[_type].FindIndex((x) =>
            {
                return x.ID == billTagCfgDict[_type][_index].ID;
            });
        }
 
        public int GetAllBillCfgCount(int _type)
        {
            return billRankCfgDict[_type].Count + billTagCfgDict[_type].Count;
        }
 
        public bool IsLock(int _type)
        {
            if (!impactRankTypeOpenDict.ContainsKey(_type))
            {
                return true;
            }
            var _condition = impactRankTypeOpenDict[_type];
            return (TimeUtility.OpenDay + 1) < _condition.start;
        }
 
        public int GetOpenDay(int _type)
        {
            var _condition = impactRankTypeOpenDict[_type];
            return _condition.start - TimeUtility.OpenDay - 1;
        }
 
        public int GetOpenStartDay(int _type)
        {
            var _condition = impactRankTypeOpenDict[_type];
            return _condition.start;
        }
 
        public int GetSurplusDay(int _type)
        {
            if (!impactRankTypeOpenDict.ContainsKey(_type))
            {
                return -1;
            }
            var _condition = impactRankTypeOpenDict[_type];
            var _day = _condition.end - TimeUtility.OpenDay;
            return _day;
        }
 
        public bool IsMissImpactRank(int _type)
        {
            if (!impactRankTypeOpenDict.ContainsKey(_type))
            {
                return true;
            }
            var _condition = impactRankTypeOpenDict[_type];
            return TimeUtility.OpenDay + 2 - TimeUtility.CreateDays > _condition.end;
        }
 
        public bool InImpactRank(int _type)
        {
            if (!IsActivityClose(_type))
            {
                return false;
            }
            OpenServerPlayerData _data;
            var _hasData = TryGetOpenServerPlayerData(_type, out _data);
            if (!_hasData)
            {
                return false;
            }
 
            RankData rankObj = rankModel.GetMyRank((int)GetRankType(_type));
            var _rank = rankObj == null ? -1 : rankObj.index + 1;
            if (_rank == -1)
            {
                return false;
            }
            for (int i = 0; i < GetAllBillCfgCount(_type); i++)
            {
                var type = GetAwardType(_type, i);
                if (type == ImpactRankAwardType.Target)
                {
                    continue;
                }
                var billRankConfig = GetRankAwardConfig(_type, i);
                if (_rank < billRankConfig.RankA || _rank > billRankConfig.RankB)
                {
                    continue;
                }
                else
                {
                    return true;
                }
            }
            return false;
        }
 
        public bool IsActivityClose(int _type)
        {
            return GetSurplusDay(_type) <= 0;
        }
 
        public bool ContainsActivity(int _type)
        {
            return impactRankTypeOpenDict.ContainsKey(_type);
        }
 
        public RankType GetRankType(int _type)
        {
            switch (_type)
            {
                case 2:
                    return RankType.OpenServerMount;
                case 1:
                    return RankType.OpenServerStrengthen;
                case 3:
                    return RankType.OpenServerGem;
                case 4:
                    return RankType.OpenServerLv;
                case 5:
                    return RankType.OpenServerRealm;
                case 6:
                    return RankType.OpenServerFightPower;
                case 7:
                    return RankType.OpenServerRune;
                case 8:
                    return RankType.OpenServerGodWeapon;
                case 9:
                    return RankType.OpenServerRecharge;
                case 10:
                    return RankType.OpenServerPet;
                case 11:
                    return RankType.OpenServerReikiPoint;
                case 12:
                    return RankType.OpenServerStartLevel;
                case 13:
                    return RankType.OpenServereEquipTrain;
            }
            return RankType.OpenServerMount;
        }
 
        public struct OSCbillBoardCondition
        {
            public int limit;
            public int start;
            public int end;
        }
        #endregion
        public event Action OnSelectRankTypeEvent;
        private int m_PresentSelectType = 0;
        public int presentSelectType {
            get { return m_PresentSelectType; }
            set {
                m_PresentSelectType = value;
                var _order = m_PresentSelectType / 100;
                var _type = m_PresentSelectType % 100;
                if (_order == 0)
                {
                    presentBillRankType = GetRankType(_type);
                }
                if (OnSelectRankTypeEvent != null)
                {
                    OnSelectRankTypeEvent();
                }
            }
        }
 
        public class RankAwardItem
        {
            private Dictionary<int, List<Item>> m_AwardDict = new Dictionary<int, List<Item>>();
            public Dictionary<int, List<Item>> AwardDic {
                get { return m_AwardDict; }
            }
            public List<Item> GetAwardItem(int _job)
            {
                List<Item> _items = null;
                m_AwardDict.TryGetValue(_job, out _items);
                return _items;
            }
 
            public void Add(int _job, Item _item)
            {
                List<Item> _list = null;
                if (!m_AwardDict.TryGetValue(_job, out _list))
                {
                    _list = new List<Item>();
                    m_AwardDict.Add(_job, _list);
                }
                _list.Add(_item);
            }
        }
 
        private RankType m_PresentBillRankType = RankType.OpenServerMount;
        public RankType presentBillRankType {
            get { return m_PresentBillRankType; }
            set {
                m_PresentBillRankType = value;
                if (CoroutineMgr.Instance.CanBegRank((int)m_PresentBillRankType))
                {
                    CoroutineMgr.Instance.StartBegRank((int)m_PresentBillRankType);
                }
                else
                {
                    return;
                }
                //C1001_tagCWatchBillboard _pak = new C1001_tagCWatchBillboard();
                //_pak.Type = (byte)m_PresentBillRankType;
                //GameNetSystem.Instance.SendInfo(_pak);
                rankModel.ResetQueryParam();
                rankModel.QueryRankByPage((int)m_PresentBillRankType);
                rankModel.QueryRankByPage((int)m_PresentBillRankType, watchID: (int)PlayerDatas.Instance.baseData.PlayerID, forceQuery: true);
            }
        }
 
        #region 协议
        public event Action OnAwardGetEvent;
        public event Action<int> onStateUpdate;
        public event Action inImpactRankUpdate;
 
        private Dictionary<int, OpenServerPlayerData> impactAwardGetDict = new Dictionary<int, OpenServerPlayerData>();
        public void UpdateGetState(HAB17_tagMCOpenServerCampaignAwardList _package)
        {
            for (int i = 0; i < _package.OSCAwardCnt; i++)
            {
                var _sData = _package.OSCAwardList[i];
                var recordData = _sData.RecordDataEx * Constants.ExpPointValue + _sData.RecordData;
                switch (_sData.CampaignType)
                {
                    case 9:
                        recordData = recordData / 100;
                        break;
                }
                impactAwardGetDict[_sData.CampaignType] = new OpenServerPlayerData()
                {
                    type = _sData.CampaignType,
                    billAwardGet = _sData.BillAwardRecord != 0,
                    tagAwardGet = (int)_sData.TagAwardRecord,
                    value = recordData
                };
            }
            if (OnAwardGetEvent != null)
            {
                OnAwardGetEvent();
            }
            UpdateRedpoint();
        }
 
        public bool TryGetOpenServerPlayerData(int _type, out OpenServerPlayerData _data)
        {
            return impactAwardGetDict.TryGetValue(_type, out _data);
        }
 
        public void SendGetAward(int _type, int _awardType, int _index)
        {
            CAB11_tagCMOpenServerCampaignAward _pak = new CAB11_tagCMOpenServerCampaignAward();
            _pak.CampaignType = (byte)_type;
            _pak.AwardType = (byte)_awardType;
            _pak.AwardIndex = (byte)_index;
            GameNetSystem.Instance.SendInfo(_pak);
        }
 
        public struct OpenServerPlayerData
        {
            public int type;
            public bool billAwardGet;
            public int tagAwardGet;
            public ulong value;
 
            public bool IsTagGet(int _index)
            {
                return (tagAwardGet & (1 << _index)) != 0;
            }
        }
        #endregion
 
        #region 红点
        public const int Redpoint_Key_ImpactRank = 25800;
        public Redpoint impactRankRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENRANK, Redpoint_Key_ImpactRank);
        private Dictionary<int, Redpoint> m_Redpoints = new Dictionary<int, Redpoint>();
 
        public bool CanGetAward(int _type, out int _displayIndex)
        {
            _displayIndex = 0;
            bool _locked = IsLock(_type);
            if (IsMissImpactRank(_type) || _locked)
            {
                return false;
            }
            if (!FuncOpen.Instance.IsFuncOpen(125))
            {
                return false;
            }
            OpenServerPlayerData _playerData;
            if (!TryGetOpenServerPlayerData(_type, out _playerData))
            {
                return false;
            }
            for (int i = 0; i < GetAllBillCfgCount(_type); i++)
            {
                var awardType = GetAwardType(_type, i);
                var _index = GetBillIndex(_type, i);
                if (awardType == ImpactRankAwardType.Target)
                {
                    var _cfg = GetTagAwardConfig(_type, i);
                    if (!_playerData.IsTagGet(GetTagIndex(_type, _index)))
                    {
                        var _complete = _playerData.value >= (ulong)_cfg.Condition;
                        if (_complete)
                        {
                            _displayIndex = i;
                            return true;
                        }
                    }
                }
                else if (IsActivityClose(_type))
                {
                    var _cfg = GetRankAwardConfig(_type, i);
                    var _start = _cfg.RankA;
                    var _end = _cfg.RankB;
                    RankData rankObj = rankModel.GetMyRank((int)GetRankType(_type));
                    var _rank = rankObj == null ? -1 : rankObj.index + 1;
                    if (_rank != -1 && _rank >= _start
                        && _rank <= _end && !_playerData.billAwardGet)
                    {
                        _displayIndex = i;
                        return true;
                    }
                }
            }
            return false;
        }
 
        public void UpdateRedpoint(int _type)
        {
            var _redpoint = m_Redpoints[_type];
            _redpoint.state = RedPointState.None;
            bool _locked = IsLock(_type);
            if (IsMissImpactRank(_type) || _locked)
            {
                return;
            }
            if (!FuncOpen.Instance.IsFuncOpen(125))
            {
                return;
            }
            ImpactRankModel.OpenServerPlayerData _playerData;
            if (!TryGetOpenServerPlayerData(_type, out _playerData))
            {
                return;
            }
            for (int i = 0; i < GetAllBillCfgCount(_type); i++)
            {
                var awardType = GetAwardType(_type, i);
                var _index = GetBillIndex(_type, i);
                if (awardType == ImpactRankAwardType.Target)
                {
                    var _cfg = GetTagAwardConfig(_type, i);
                    if (!_playerData.IsTagGet(GetTagIndex(_type, _index)))
                    {
                        var _complete = _playerData.value >= (ulong)(_cfg as OSCBillTagAwardConfig).Condition;
                        if (_complete)
                        {
                            _redpoint.state = RedPointState.GetReward;
                            return;
                        }
                    }
                }
                //else if (IsActivityClose(_type))
                //{
                //    var _cfg = GetRankAwardConfig(_type, i);
                //    var _start = _cfg.RankA;
                //    var _end = _cfg.RankB;
                //    var _rank = 0;
                //    if (!rankModel.TryGetMyRank((int)GetRankType(_type), out _rank))
                //    {
                //        _rank = -1;
                //    }
                //    if (_rank != -1 && _rank >= _start
                //        && _rank <= _end && !_playerData.billAwardGet)
                //    {
                //        _redpoint.state = RedPointState.GetReward;
                //        return;
                //    }
                //}
            }
        }
 
        public void UpdateRedpoint()
        {
            foreach (var _type in m_Redpoints.Keys)
            {
                UpdateRedpoint(_type);
            }
        }
        #endregion
        /// <summary>
        /// 1.优先选中有红点的标签页
        /// 2.若无红点,优先选中活动进行中的标签页
        /// 3.若无活动进行中的标签页,默认选中第一个标签页
        /// </summary>
        /// <returns></returns>
        public int GetDefaultSelectType()
        {
            if (gotoImpactRankType != 0 && impactRankSorts.Contains(gotoImpactRankType))
            {
                var _tyep = gotoImpactRankType;
                gotoImpactRankType = 0;
                return _tyep;
            }
            for (int i = 0; i < impactRankSorts.Count; i++)
            {
                var _type = impactRankSorts[i];
                if (m_Redpoints[_type].state == RedPointState.GetReward
                    || m_Redpoints[_type].state == RedPointState.Simple)
                {
                    return _type;
                }
            }
            for (int i = 0; i < impactRankSorts.Count; i++)
            {
                var _type = impactRankSorts[i];
                if (!IsActivityClose(_type) && !IsMissImpactRank(_type))
                {
                    return _type;
                }
            }
            return impactRankSorts[0];
        }
 
        public bool HasRedpoint()
        {
            foreach (var _key in m_Redpoints.Keys)
            {
                if (m_Redpoints[_key].state == RedPointState.GetReward
                    || m_Redpoints[_key].state == RedPointState.Simple)
                {
                    return true;
                }
            }
            return false;
        }
 
        #region 主界面特效
        public bool OSCEffectOpen { get; set; }
 
        public bool IsOpen {
            get {
                return TimeUtility.OpenDay < openServerActivityDays && FuncOpen.Instance.IsFuncOpen(125);
            }
        }
 
        public bool priorityOpen {
            get {
                var state = impactRankRedpoint.state;
                return state == RedPointState.Simple || state == RedPointState.GetReward;
            }
        }
 
        public bool IsInImpactRank {
            get {
                return TimeUtility.OpenDay < openServerRankDays && FuncOpen.Instance.IsFuncOpen(125);
            }
        }
 
        public bool IsAdvance {
            get {
                return false;
            }
        }
        #endregion
 
        public enum ImpactRankAwardType
        {
            Rank,
            Target,
        }
    }
}