using System.Collections;
|
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 {
|
get { return m_MakeFakeLineTimes; }
|
set { m_MakeFakeLineTimes = Mathf.Clamp(value, 0, int.MaxValue); }
|
}
|
|
bool m_ShowFakeLine = false;
|
public bool showFakeLine {
|
get { return m_ShowFakeLine; }
|
set { m_ShowFakeLine = value; }
|
}
|
|
public BossFakeLineUtility()
|
{
|
DTC0102_tagCDBPlayer.switchAccountEvent += OnAccountSwitch;
|
}
|
|
//这个值在初见boss和最后看见boss的时候记录,其值为time.time+1分钟,这段时间内告诉玩家其所在分线的boss的死亡情况,否则告诉玩家公共boss的死亡情况。
|
public uint lastBossNpcID;
|
public float inMistakeForBossAliveOverTime = 0f;
|
|
public bool IsShuntBoss(int _bossId)
|
{
|
if (TimeUtility.OpenDay > GeneralConfig.Instance.bossShuntDays)
|
{
|
return false;
|
}
|
else
|
{
|
GAStaticDefine.NPCLocation location;
|
var find = GAStaticDefine.TryGetMapNPCLocation(_bossId, out location);
|
return find && GeneralConfig.Instance.bossShuntMaps.Contains(location.mapId);
|
}
|
}
|
|
public bool IsBossVisible(int _bossId)
|
{
|
if (PlayerDatas.Instance.hero == null)
|
{
|
return false;
|
}
|
else
|
{
|
return GAMgr.Instance.GetCloserNPC(PlayerDatas.Instance.hero.Pos, _bossId) != null;
|
}
|
}
|
|
public bool IsBossTombstoneVisble(int _bossId)
|
{
|
if (PlayerDatas.Instance.hero == null)
|
{
|
return false;
|
}
|
else
|
{
|
var bossInfoConfig = Config.Instance.Get<BossInfoConfig>(_bossId);
|
var tombstoneId = bossInfoConfig.StoneNPCID;
|
return GAMgr.Instance.GetCloserNPC(PlayerDatas.Instance.hero.Pos, tombstoneId) != null;
|
}
|
}
|
|
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();
|
}
|
|
}
|