From eb4cb947c8753bf90a72ea3fc195626cb36e6cf6 Mon Sep 17 00:00:00 2001
From: client_Hale <339726288@qq.com>
Date: 星期二, 22 十月 2019 01:32:15 +0800
Subject: [PATCH] Merge branch 'master' of http://192.168.0.87:10010/r/snxxz_scripts

---
 System/OpenServerActivity/BossFirstBloodModel.cs |   74 ++++++++++++++++++++++++++++++++++++
 1 files changed, 73 insertions(+), 1 deletions(-)

diff --git a/System/OpenServerActivity/BossFirstBloodModel.cs b/System/OpenServerActivity/BossFirstBloodModel.cs
index 961ff79..eed4a0f 100644
--- a/System/OpenServerActivity/BossFirstBloodModel.cs
+++ b/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)

--
Gitblit v1.8.0