| | |
| | | using System.Collections; |
| | | using UnityEngine.UI; |
| | | using UnityEngine.Events; |
| | | using System; |
| | | |
| | | namespace vnxbqy.UI |
| | | { |
| | | [RequireComponent(typeof(RectTransform))] |
| | | public class FakeButton2 : MonoBehaviour |
| | | { |
| | |
| | | public RectTransform rectTransform { get { return m_RectTransform ?? (m_RectTransform = this.transform as RectTransform); } } |
| | | |
| | | float overTime = float.MaxValue; |
| | | UIEvent m_OnClick = new UIEvent(); |
| | | Action m_OnClick; |
| | | |
| | | public void AddListener(UnityAction _callBack) |
| | | public void AddListener(Action _callBack) |
| | | { |
| | | m_OnClick.AddListener(_callBack); |
| | | m_OnClick += _callBack; |
| | | } |
| | | |
| | | public void RemoveAllListeners() |
| | | { |
| | | m_OnClick.RemoveAllListeners(); |
| | | m_OnClick = null; |
| | | } |
| | | |
| | | private void LateUpdate() |
| | |
| | | { |
| | | if (Time.realtimeSinceStartup > overTime) |
| | | { |
| | | m_OnClick.Invoke(); |
| | | m_OnClick?.Invoke(); |
| | | overTime = float.MaxValue; |
| | | } |
| | | } |
| | |
| | | } |
| | | |
| | | } |
| | | |
| | | } |
| | | |
| | | |
| | | |