// Decompiled with JetBrains decompiler
// Type: UnityEngine.UI.Button
// Assembly: UnityEngine.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
// MVID: 2216A18B-AF52-44A5-85A0-A1CAA19C1090
// Assembly location: C:\Users\Blake\sandbox\unity\test-project\Library\UnityAssemblies\UnityEngine.UI.dll
using System;
using System.Collections;
using System.Diagnostics;
using UnityEngine.Events;
using UnityEngine.EventSystems;
using UnityEngine.Serialization;
namespace UnityEngine.UI
{
///
/// A standard button that can be clicked in order to trigger an event.
///
[AddComponentMenu("UI/Button", 30)]
public class Button : Selectable, IEventSystemHandler, IPointerClickHandler, ISubmitHandler
{
[FormerlySerializedAs("onClick")]
[SerializeField]
private Button.ButtonClickedEvent m_OnClick = new Button.ButtonClickedEvent();
///
/// UnityEvent to be fired when the buttons is pressed.
///
public Button.ButtonClickedEvent onClick
{
get
{
return this.m_OnClick;
}
set
{
this.m_OnClick = value;
}
}
protected Button()
{
}
private void Press()
{
if (!this.IsActive() || !this.IsInteractable())
return;
this.m_OnClick.Invoke();
}
///
/// Registered IPointerClickHandler callback.
///
/// Data passed in (Typically by the event system).
public virtual void OnPointerClick(PointerEventData eventData)
{
if (eventData.button != PointerEventData.InputButton.Left)
return;
this.Press();
}
///
/// Registered ISubmitHandler callback.
///
/// Data passed in (Typically by the event system).
public virtual void OnSubmit(BaseEventData eventData)
{
this.Press();
if (!this.IsActive() || !this.IsInteractable())
return;
this.DoStateTransition(Selectable.SelectionState.Pressed, false);
this.StartCoroutine(this.OnFinishSubmit());
}
[DebuggerHidden]
private IEnumerator OnFinishSubmit()
{
// ISSUE: object of a compiler-generated type is created
return (IEnumerator) new Button.\u003COnFinishSubmit\u003Ec__Iterator1() { \u003C\u003Ef__this = this };
}
///
/// Function definition for a button click event.
///
[Serializable]
public class ButtonClickedEvent : UnityEvent
{
}
}
}