//--------------------------------------------------------
|
// [Author]: 第二世界
|
// [ Date ]: Monday, August 06, 2018
|
//--------------------------------------------------------
|
using UnityEngine;
|
using System.Collections;
|
using UnityEngine.UI;
|
using System;
|
|
namespace Snxxz.UI {
|
|
public class LimitedTimePackageTime:MonoBehaviour {
|
|
[SerializeField] Text m_LimitedTimePackageTime_text;
|
|
private void OnEnable()
|
{
|
GlobalTimeEvent.Instance.secondEvent += secondEvent;
|
}
|
private void OnDisable()
|
{
|
GlobalTimeEvent.Instance.secondEvent -= secondEvent;
|
}
|
|
private void secondEvent()
|
{
|
int time = OperationTimeHepler.Instance.GetOperationSurplusTime(Operation.GiftPackage);
|
if (time <= 0)
|
{
|
if (m_LimitedTimePackageTime_text.gameObject.activeSelf)
|
{
|
m_LimitedTimePackageTime_text.gameObject.SetActive(false);
|
}
|
return;
|
}
|
if (time>86400)
|
{
|
if (m_LimitedTimePackageTime_text.gameObject.activeSelf)
|
{
|
m_LimitedTimePackageTime_text.gameObject.SetActive(false);
|
}
|
}
|
else
|
{
|
if (!m_LimitedTimePackageTime_text.gameObject.activeSelf)
|
{
|
m_LimitedTimePackageTime_text.gameObject.SetActive(true);
|
}
|
if (time<3600)
|
{
|
m_LimitedTimePackageTime_text.text = TimeUtility.SecondsToHMS(time);
|
m_LimitedTimePackageTime_text.color = UIHelper.GetUIColor(TextColType.Red);
|
|
}
|
else
|
{
|
m_LimitedTimePackageTime_text.text = TimeUtility.SecondsToHMS(time);
|
m_LimitedTimePackageTime_text.color = UIHelper.GetUIColor(TextColType.Green);
|
}
|
}
|
|
}
|
}
|
|
}
|
|
|
|