| | |
| | | public class FairySiegeCoolTime : MonoBehaviour |
| | | { |
| | | [SerializeField] Image m_bg; |
| | | [SerializeField] Text m_Time; |
| | | |
| | | [SerializeField] Text m_Time;
|
| | | FairySiegeActModel model { get { return ModelCenter.Instance.GetModel<FairySiegeActModel>(); } } |
| | | private void OnEnable() |
| | | { |
| | | 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); |
| | | } |
| | | m_Time.SetActive(true);
|
| | | int stateValue;
|
| | | if (model.TryGetCurrentStateValue(out stateValue))
|
| | | {
|
| | | int state = model.GetStateByStateValue(stateValue);
|
| | | if (state == 4)//0 公示期 1 备战期 2 开战期 3 休战期 4 领奖期
|
| | | {
|
| | | m_Time.text = StringUtility.Contact("<color=#8DDC11FF>", Language.Get("FairySiege153"), "</color>");
|
| | | }
|
| | | else
|
| | | {
|
| | | m_bg.SetActive(false);
|
| | | m_Time.SetActive(false);
|
| | | }
|
| | | }
|
| | | 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; |
| | | } |
| | | } |
| | | } |