少年修仙传客户端代码仓库
hch
2019-10-22 14bb760c2802cd11702d362c4e4847ce97b95b39
System/OpenServerActivity/BossFirstBloodModel.cs
@@ -30,6 +30,9 @@
        Dictionary<int, int> FirstKillStateInfo = new Dictionary<int, int>(); // 击杀奖励状态
        public Dictionary<int, FirstKillTimeInfo> firstKillTimeInfo = new Dictionary<int, FirstKillTimeInfo>(); // 首杀名和时间
        private Dictionary<int, Redpoint> m_Redpoints = new Dictionary<int, Redpoint>();
        private Dictionary<int, Redpoint> m_RedPackRedpoints = new Dictionary<int, Redpoint>();
        public List<string> npcIDConfig;
        public bool IsOpen
        {
@@ -49,12 +52,30 @@
            }
        }
        public const int Redpoint_BossKillRank = 25900;
        public Redpoint rankRedpoint = new Redpoint(MainRedDot.REDPOINT_OPENRANK, Redpoint_BossKillRank);
        public bool IsAdvance
        {
            get
            {
                return false;
            }
        }
        public void UpdateAllRedPoint()
        {
            foreach (var _key in m_Redpoints.Keys)
            {
                UpdateRedPoint(_key, GetPersonalKillAwardState(_key) == 1 ? RedPointState.Simple : RedPointState.None);
            }
        }
        public void UpdateRedPoint(int npcID, RedPointState state)
        {
            var _redpoint = m_Redpoints[npcID];
            _redpoint.state = m_RedPackRedpoints[npcID].state == RedPointState.None ? state : m_RedPackRedpoints[npcID].state;
        }
@@ -89,7 +110,40 @@
                    if (!WindowCenter.Instance.IsOpen<BossFirstBloodWin>() && OnFirstKillInfo != null)
                        OnFirstKillInfo(npcID);
                }
                UpdateAllRedPackPoint();
                UpdateAllRedPoint();
            }
        }
        public int GetBossKillAwardState(int npcID)
        {
            //0 未击杀 1 可领取 2 已领取
            if (firstKillTimeInfo.ContainsKey(npcID) && !string.IsNullOrEmpty(firstKillTimeInfo[npcID].name))
            {
                //无数据为可领取
                if (!FirstKillStateInfo.ContainsKey(npcID)) return 1;
                int state = FirstKillStateInfo[npcID];
                if (state/10 % 10 == 0)
                    return 1;
                else
                    return 2;
            }
            return 0;
        }
        public void UpdateAllRedPackPoint()
        {
            foreach (var _key in m_RedPackRedpoints.Keys)
            {
                UpdateRedPackPoint(_key);
            }
        }
        public void UpdateRedPackPoint(int npcID)
        {
            var state = GetBossKillAwardState(npcID) == 1 ? RedPointState.Simple : RedPointState.None;
            m_RedPackRedpoints[npcID].state = state;
        }
@@ -113,11 +167,27 @@
                var infoY = BOSSFirstKillConfig.Get(y);
                return infoX.Sort.CompareTo(infoY.Sort);
            });
            foreach (var key in npcIDConfig)
            {
                var npcID = int.Parse(key);
                var infoX = BOSSFirstKillConfig.Get(key);
                m_Redpoints.Add(npcID, new Redpoint(Redpoint_BossKillRank, Redpoint_BossKillRank * 100 + infoX.Sort));
                m_RedPackRedpoints.Add(npcID, new Redpoint(Redpoint_BossKillRank * 100 + infoX.Sort, (Redpoint_BossKillRank * 100 + infoX.Sort)*10));
            }
        }
        public int GetNPCRedPackPointID(int npcID)
        {
            var infoX = BOSSFirstKillConfig.Get(npcID);
            return (Redpoint_BossKillRank * 100 + infoX.Sort) * 10;
        }
        public override void UnInit()
        {
            DTCA003_tagUniversalGameRecInfo.onGetUniversalGameInfo -= OnGetUniversalGameInfo;
        }
        public event Action<int> UpdatePersonnalKillEvent;
        public void BossFirstKillStateInfo(HAB01_tagMCBossFirstKillStateInfo package)
@@ -128,6 +198,8 @@
                if (UpdatePersonnalKillEvent != null)
                    UpdatePersonnalKillEvent((int)package.FirstKillStateList[i].NPCID);
            }
            UpdateAllRedPackPoint();
            UpdateAllRedPoint();
        }
        public int GetPersonalKillAwardState(int npcID)