| | |
| | | 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和最后看见boss的时候记录,其值为time.time+1分钟,这段时间内告诉玩家其所在分线的boss的死亡情况,否则告诉玩家公共boss的死亡情况。 |
| | |
| | | } |
| | | } |
| | | |
| | | 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(); |
| | | } |
| | | |
| | | } |