| 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.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 = (int)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 int 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 >= _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 >= (_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,  | 
|         }  | 
|     }  | 
| }  | 
|   |