3335 替换boss复活倒计时机制,由使用本机时间修改为使用服务器时间,防止玩家在倒计时过程中修改本机时间导致倒计时表现错误。
| | |
| | | |
| | | if (refreshTime > DateTime.Now) |
| | | { |
| | | m_CoolDown.Begin(refreshTime, OnBossCoolDownCompleted); |
| | | m_CoolDown.Begin((int)(refreshTime - TimeUtility.ServerNow).TotalSeconds, OnBossCoolDownCompleted); |
| | | } |
| | | else |
| | | { |
| | |
| | | {
|
| | | if (!bossInfo.IsBossAlive())
|
| | | {
|
| | | m_RebornTime.Begin(bossInfo.refreshTime);
|
| | | m_RebornTime.Begin((int)(bossInfo.refreshTime - TimeUtility.ServerNow).TotalSeconds);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | var rebornAtOnce = bossInfo.refreshTime < DateTime.Now && !isAlive;
|
| | | var rebornAtOnce = bossInfo.refreshTime < TimeUtility.ServerNow && !isAlive;
|
| | |
|
| | | if (rebornAtOnce)
|
| | | {
|
| | |
| | | |
| | | if (!bossInfo.IsBossAlive()) |
| | | { |
| | | m_Timer.Begin(bossInfo.refreshTime); |
| | | m_Timer.timeShow.color = demonJarModel.GetSurplusTimes() > 0 ? UIHelper.GetUIColor(TextColType.Green) : UIHelper.GetUIColor(TextColType.Red); |
| | | m_Timer.Begin((int)(bossInfo.refreshTime - TimeUtility.ServerNow).TotalSeconds); |
| | | m_Timer.timeShow.color = UIHelper.GetUIColor(demonJarModel.GetSurplusTimes() > 0 ? TextColType.Green : TextColType.Red); |
| | | } |
| | | } |
| | | else |
| | |
| | | |
| | | private void OnDungeonRecodChange(int _dataMapId) |
| | | { |
| | | m_Timer.timeShow.color = demonJarModel.GetSurplusTimes() > 0 ? UIHelper.GetUIColor(TextColType.Green) : UIHelper.GetUIColor(TextColType.Red); |
| | | m_Timer.timeShow.color = UIHelper.GetUIColor(demonJarModel.GetSurplusTimes() > 0 ? TextColType.Green : TextColType.Red); |
| | | } |
| | | |
| | | } |
| | |
| | | if (dungeonModel.TryGetCountRemainTime(DemonJarModel.DEMONJAR_MAPID, out endTime))
|
| | | {
|
| | | m_CountRemainTime.gameObject.SetActive(true);
|
| | | m_CountRemainTime.Begin(endTime);
|
| | | m_CountRemainTime.Begin((int)(endTime - TimeUtility.ServerNow).TotalSeconds);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | FindPreciousModel.BossInfo bossInfo = null;
|
| | | if (findPreciousModel.TryGetBossInfo(bossId, out bossInfo))
|
| | | {
|
| | | return !findPreciousModel.IsBossAlive(bossId) && DateTime.Now > bossInfo.refreshTime;
|
| | | return !findPreciousModel.IsBossAlive(bossId) && TimeUtility.ServerNow > bossInfo.refreshTime;
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | FindPreciousModel.BossInfo bossInfo;
|
| | | if (findPreciousModel.TryGetBossInfo(bossId, out bossInfo) && !bossInfo.IsBossAlive())
|
| | | {
|
| | | if (DateTime.Now > bossInfo.refreshTime)
|
| | | if (TimeUtility.ServerNow > bossInfo.refreshTime)
|
| | | {
|
| | | m_CoolDown.gameObject.SetActive(false);
|
| | | }
|
| | | else
|
| | | {
|
| | | m_CoolDown.Begin(bossInfo.refreshTime, OnBossCoolDownCompleted);
|
| | | m_CoolDown.Begin((int)(bossInfo.refreshTime - TimeUtility.ServerNow).TotalSeconds, OnBossCoolDownCompleted);
|
| | | }
|
| | | }
|
| | | else
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if ((bossInfos[bossId].refreshTime - DateTime.Now).TotalSeconds < PREPOSE_SECONDS)
|
| | | if ((bossInfos[bossId].refreshTime - TimeUtility.ServerNow).TotalSeconds < PREPOSE_SECONDS)
|
| | | {
|
| | | AddOneBossRebornNotify(bossId);
|
| | | }
|
| | |
| | | }
|
| | | else
|
| | | {
|
| | | if (IsBossAlive(bossId) || (bossInfos[bossId].refreshTime - DateTime.Now).TotalSeconds < PREPOSE_SECONDS)
|
| | | if (IsBossAlive(bossId) || (bossInfos[bossId].refreshTime - TimeUtility.ServerNow).TotalSeconds < PREPOSE_SECONDS)
|
| | | {
|
| | | AddOneBossRebornNotify(bossId);
|
| | | }
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | refreshTime = DateTime.Now + new TimeSpan(_bossInfo.RefreshSecond * TimeSpan.TicksPerSecond);
|
| | | refreshTime = TimeUtility.ServerNow + new TimeSpan(_bossInfo.RefreshSecond * TimeSpan.TicksPerSecond);
|
| | | }
|
| | |
|
| | | public bool IsBossAlive()
|
| | |
| | | for (int i = bossIds.Count - 1; i >= 0; i--) |
| | | { |
| | | var clock = clocks[bossIds[i]]; |
| | | if ((clock.rebornTime - DateTime.Now).TotalSeconds < FindPreciousModel.PREPOSE_SECONDS) |
| | | if ((clock.rebornTime - TimeUtility.ServerNow).TotalSeconds < FindPreciousModel.PREPOSE_SECONDS) |
| | | { |
| | | clocks.Remove(bossIds[i]); |
| | | bossIds.RemoveAt(i); |
| | |
| | | |
| | | private bool IsValidClockSetting(DateTime _rebornTime) |
| | | { |
| | | return (_rebornTime - DateTime.Now).TotalSeconds >= FindPreciousModel.PREPOSE_SECONDS; |
| | | return (_rebornTime - TimeUtility.ServerNow).TotalSeconds >= FindPreciousModel.PREPOSE_SECONDS; |
| | | } |
| | | |
| | | public class BossRebornClock |
| | |
| | | void DisplayTime(int seconds)
|
| | | {
|
| | | m_Time.timeShow.color = seconds > 3600 ? UIHelper.GetUIColor(TextColType.Green) : UIHelper.GetUIColor(TextColType.Red);
|
| | | m_Time.Begin(DateTime.Now.AddTicks(seconds * TimeSpan.TicksPerSecond));
|
| | | m_Time.Begin(seconds);
|
| | | }
|
| | |
|
| | | void DisplayAdvance(int seconds)
|
| | |
| | | m_MatchState.text = model.isMatching ? Language.Get("StopMatching") : Language.Get("TeamListAutoMatching");
|
| | | if (model.isMatching)
|
| | | {
|
| | | m_MatchingCoolDown.Begin(model.matchingEndTime);
|
| | | m_MatchingCoolDown.Begin((int)(model.matchingEndTime - DateTime.Now).TotalSeconds);
|
| | | }
|
| | | else
|
| | | {
|
| | |
| | | using UnityEngine.UI;
|
| | | using System;
|
| | |
|
| | | namespace Snxxz.UI {
|
| | | namespace Snxxz.UI
|
| | | {
|
| | |
|
| | | public class LimitedTimePackageTime:MonoBehaviour {
|
| | | public class LimitedTimePackageTime : MonoBehaviour
|
| | | {
|
| | |
|
| | | [SerializeField] TimerBehaviour m_Time;
|
| | | [SerializeField] RectTransform m_ContainerAdvance;
|
| | |
| | | void DisplayTime(int seconds)
|
| | | {
|
| | | m_Time.timeShow.color = seconds > 3600 ? UIHelper.GetUIColor(TextColType.Green) : UIHelper.GetUIColor(TextColType.Red);
|
| | | m_Time.Begin(DateTime.Now.AddTicks(seconds * TimeSpan.TicksPerSecond));
|
| | | m_Time.Begin(seconds);
|
| | | }
|
| | | void DisplayAdvance(int seconds)
|
| | | {
|
| | |
| | |
|
| | | float secondTimer = 0f;
|
| | |
|
| | | public void Begin(DateTime _endTime, Action _callBack = null)
|
| | | public void Begin(int seconds, Action _callBack = null)
|
| | | {
|
| | | endTime = _endTime;
|
| | | endTime = TimeUtility.ServerNow + new TimeSpan(seconds * TimeSpan.TicksPerSecond);
|
| | | onTime = _callBack;
|
| | | if (endTime > DateTime.Now)
|
| | | if (endTime > TimeUtility.ServerNow)
|
| | | {
|
| | | this.gameObject.SetActive(true);
|
| | | UpdateTimeShow();
|
| | |
| | |
|
| | | private void LateUpdate()
|
| | | {
|
| | | if (DateTime.Now > endTime)
|
| | | if (TimeUtility.ServerNow > endTime)
|
| | | {
|
| | | if (onTime != null)
|
| | | {
|
| | |
| | |
|
| | | protected virtual void UpdateTimeShow()
|
| | | {
|
| | | var lastSecond = (float)(endTime - DateTime.Now).TotalSeconds;
|
| | | var lastSecond = (float)(endTime - TimeUtility.ServerNow).TotalSeconds;
|
| | |
|
| | | switch (m_Pattern)
|
| | | {
|
| | |
| | | {
|
| | | m_RebornTime.gameObject.SetActive(true);
|
| | | (m_TimeBehaviour as TimerToChsBehaviour).addtionInfo = Language.Get("BossReborn_RefreshTime");
|
| | | m_TimeBehaviour.Begin(_bossInfo.refreshTime, () =>
|
| | | m_TimeBehaviour.Begin( (int)(_bossInfo.refreshTime - TimeUtility.ServerNow).TotalSeconds, () =>
|
| | | {
|
| | | m_NpcAppearTxt.gameObject.SetActive(true);
|
| | | });
|