From 9550f1c5aec05b5c6c5eabc5cae9d9c944eddf5d Mon Sep 17 00:00:00 2001
From: client_Wu Xijin <364452445@qq.com>
Date: 星期三, 26 九月 2018 16:35:33 +0800
Subject: [PATCH] Merge 3811 【前端】前期BOSS分线修改

---
 Fight/BossFakeLineUtility.cs |   68 ++++++++++++++++++++++++++++++++--
 1 files changed, 64 insertions(+), 4 deletions(-)

diff --git a/Fight/BossFakeLineUtility.cs b/Fight/BossFakeLineUtility.cs
index cb66517..a5fd8ee 100644
--- a/Fight/BossFakeLineUtility.cs
+++ b/Fight/BossFakeLineUtility.cs
@@ -2,21 +2,26 @@
 using System.Collections.Generic;
 using UnityEngine;
 using TableConfig;
+using System;
+using Snxxz.UI;
 
 public class BossFakeLineUtility : Singleton<BossFakeLineUtility>
 {
     int m_MakeFakeLineTimes = 0;
-    public int makeFakeLineTimes
-    {
+    public int makeFakeLineTimes {
         get { return m_MakeFakeLineTimes; }
         set { m_MakeFakeLineTimes = Mathf.Clamp(value, 0, int.MaxValue); }
     }
 
     bool m_ShowFakeLine = false;
-    public bool showFakeLine
-    {
+    public bool showFakeLine {
         get { return m_ShowFakeLine; }
         set { m_ShowFakeLine = value; }
+    }
+
+    public BossFakeLineUtility()
+    {
+        DTC0102_tagCDBPlayer.switchAccountEvent += OnAccountSwitch;
     }
 
     //杩欎釜鍊煎湪鍒濊boss鍜屾渶鍚庣湅瑙乥oss鐨勬椂鍊欒褰曪紝鍏跺�间负time.time+1鍒嗛挓锛岃繖娈垫椂闂村唴鍛婅瘔鐜╁鍏舵墍鍦ㄥ垎绾跨殑boss鐨勬浜℃儏鍐碉紝鍚﹀垯鍛婅瘔鐜╁鍏叡boss鐨勬浜℃儏鍐点��
@@ -63,5 +68,60 @@
         }
     }
 
+    FindPreciousModel findPreciousModel { get { return ModelCenter.Instance.GetModel<FindPreciousModel>(); } }
+    Dictionary<int, DateTime> bossKillTimes = new Dictionary<int, DateTime>();
+
+    public void RecordBossKillTime(int npcId, DateTime time)
+    {
+        var key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "_", npcId);
+        bossKillTimes[npcId] = time;
+        LocalSave.SetString(key, time.ToString());
+    }
+
+    public bool IsBossKilledRecently(int npcId)
+    {
+        FindPreciousModel.BossInfo bossInfo;
+        var totalCd = 0;
+        if (findPreciousModel.TryGetBossInfo(npcId, out bossInfo))
+        {
+            totalCd = bossInfo.rebornTotalCd;
+        }
+
+        if (bossKillTimes.ContainsKey(npcId))
+        {
+            var killTime = bossKillTimes[npcId];
+            if ((int)((DateTime.Now - killTime).TotalSeconds) < totalCd)
+            {
+                return true;
+            }
+        }
+
+        var key = StringUtility.Contact(PlayerDatas.Instance.baseData.PlayerID, "_", npcId);
+        var timeString = LocalSave.GetString(key);
+        if (string.IsNullOrEmpty(timeString))
+        {
+            return false;
+        }
+        else
+        {
+            var tempTime = DateTime.Now;
+            if (DateTime.TryParse(timeString, out tempTime))
+            {
+                if ((int)((DateTime.Now - tempTime).TotalSeconds) < totalCd)
+                {
+                    bossKillTimes[npcId] = tempTime;
+                    return true;
+                }
+            }
+        }
+
+        return false;
+    }
+
+
+    private void OnAccountSwitch()
+    {
+        bossKillTimes.Clear();
+    }
 
 }

--
Gitblit v1.8.0