123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172 |
- using System;
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- using UnityEngine.SceneManagement;
- using UnityEngine.UI;
- using static UnityEngine.UI.Button;
- /// <summary>
- /// 晶格操作按钮
- /// </summary>
- public class LatticeButton : MonoBehaviour
- {
- public GameObject m_focusObj;
- //数字越大 级别越低
- public int level = 1;
- //数字越大约靠后
- public int order = 1;
- public Action OnFocus;
- public Action OnUnFocus;
- public ButtonClickedEvent onClick { get; set; }
- public LatticeButton()
- {
- onClick = new ButtonClickedEvent();
- }
- void Awake()
- {
- LatticeBrain.RegButton(this);
- if (m_focusObj != null)
- {
- m_focusObj.SetActive(false);
- }
- }
- void OnDestroy()
- {
- LatticeBrain.RemoveButton(this);
- }
- public void MonoFocus()
- {
- OnFocus?.Invoke();
- if (m_focusObj != null)
- {
- m_focusObj.SetActive(true);
- }
- }
- public void MonoUnFocus()
- {
- OnUnFocus?.Invoke();
- if (m_focusObj != null)
- {
- m_focusObj.SetActive(false);
- }
- }
- //public bool InFocus
- //{
- // get
- // {
- // return m_focusObj
- // }
- //}
- }
|