using UnityEngine;
|
using UnityEngine.UI;
|
|
namespace vnxbqy.UI
|
{
|
public class FairySiegeCoolTime : MonoBehaviour
|
{
|
[SerializeField] Image m_bg;
|
[SerializeField] Text m_Time;
|
|
private void OnEnable()
|
{
|
GlobalTimeEvent.Instance.secondEvent += RefreshSecond;
|
RefreshSecond();
|
}
|
|
private void OnDisable()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= RefreshSecond;
|
}
|
|
private void RefreshSecond()
|
{
|
m_bg.SetActive(true);
|
m_Time.SetActive(true);
|
var seconds = GetOperationSurplusTime(Operation.default53);
|
if (seconds > 0)
|
{
|
if (seconds < 86400)
|
{
|
m_Time.text = StringUtility.Contact("<color=#8DDC11FF>", Language.Get("FairySiege153"), "</color>");
|
}
|
else
|
{
|
m_bg.SetActive(false);
|
m_Time.SetActive(false);
|
}
|
}
|
else
|
{
|
m_Time.text = UIHelper.AppendColor(TextColType.Red, Language.Get("XMZZ110"));
|
}
|
}
|
|
public int GetOperationSurplusTime(Operation type)
|
{
|
OperationBase operation;
|
if (OperationTimeHepler.Instance.TryGetOperationTime(type, out operation))
|
return operation.GetSurplusTime(ILTimeUtility.ServerCrossNow);
|
return 0;
|
}
|
}
|
}
|