diff options
author | chai <chaifix@163.com> | 2021-04-07 19:10:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-04-07 19:10:30 +0800 |
commit | e7dfbec8e8634e767d78959941daf71a96e021cf (patch) | |
tree | 58895a7c60df0bd3f316e6461051eabd1c0a51e1 /Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Button.cs | |
parent | ff5a3fbf31db349db11bbc5c60ba199d26780f19 (diff) |
*移动目录
Diffstat (limited to 'Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Button.cs')
-rw-r--r-- | Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Button.cs | 75 |
1 files changed, 0 insertions, 75 deletions
diff --git a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Button.cs b/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Button.cs deleted file mode 100644 index 8be5532..0000000 --- a/Assets/uGUI-2017.1/UnityEngine.UI/UI/Core/Button.cs +++ /dev/null @@ -1,75 +0,0 @@ -using System; -using System.Collections; -using UnityEngine.Events; -using UnityEngine.EventSystems; -using UnityEngine.Serialization; - -namespace UnityEngine.UI -{ - // Button that's meant to work with mouse or touch-based devices. - [AddComponentMenu("UI/Button", 30)] - public class Button : Selectable, IPointerClickHandler, ISubmitHandler - { - [Serializable] - public class ButtonClickedEvent : UnityEvent {} - - // Event delegates triggered on click. - [FormerlySerializedAs("onClick")] - [SerializeField] - private ButtonClickedEvent m_OnClick = new ButtonClickedEvent(); - - protected Button() - {} - - public ButtonClickedEvent onClick - { - get { return m_OnClick; } - set { m_OnClick = value; } - } - - private void Press() - { - if (!IsActive() || !IsInteractable()) - return; - - UISystemProfilerApi.AddMarker("Button.onClick", this); - m_OnClick.Invoke(); - } - - // Trigger all registered callbacks. - public virtual void OnPointerClick(PointerEventData eventData) - { - if (eventData.button != PointerEventData.InputButton.Left) - return; - - Press(); - } - - public virtual void OnSubmit(BaseEventData eventData) - { - Press(); - - // if we get set disabled during the press - // don't run the coroutine. - if (!IsActive() || !IsInteractable()) - return; - - DoStateTransition(SelectionState.Pressed, false); - StartCoroutine(OnFinishSubmit()); - } - - private IEnumerator OnFinishSubmit() - { - var fadeTime = colors.fadeDuration; - var elapsedTime = 0f; - - while (elapsedTime < fadeTime) - { - elapsedTime += Time.unscaledDeltaTime; - yield return null; - } - - DoStateTransition(currentSelectionState, false); - } - } -} |