少年修仙传客户端代码仓库
lcy
2025-05-08 1314c3b3c14cd520bbb8569b5f98d68933a22cd3
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
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;
        }
    }
}