scripts
This commit is contained in:
@@ -0,0 +1,88 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine.Events;
|
||||
using UnityEngine.EventSystems;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
namespace UnityEngine.UI
|
||||
{
|
||||
// Token: 0x0200003A RID: 58
|
||||
[AddComponentMenu("UI/Button", 30)]
|
||||
public class Button : Selectable, IPointerClickHandler, ISubmitHandler, IEventSystemHandler
|
||||
{
|
||||
// Token: 0x06000181 RID: 385 RVA: 0x00007B73 File Offset: 0x00005F73
|
||||
protected Button()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x17000068 RID: 104
|
||||
// (get) Token: 0x06000182 RID: 386 RVA: 0x00007B88 File Offset: 0x00005F88
|
||||
// (set) Token: 0x06000183 RID: 387 RVA: 0x00007BA3 File Offset: 0x00005FA3
|
||||
public Button.ButtonClickedEvent onClick
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_OnClick;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.m_OnClick = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000184 RID: 388 RVA: 0x00007BAD File Offset: 0x00005FAD
|
||||
private void Press()
|
||||
{
|
||||
if (this.IsActive() && this.IsInteractable())
|
||||
{
|
||||
UISystemProfilerApi.AddMarker("Button.onClick", this);
|
||||
this.m_OnClick.Invoke();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000185 RID: 389 RVA: 0x00007BE1 File Offset: 0x00005FE1
|
||||
public virtual void OnPointerClick(PointerEventData eventData)
|
||||
{
|
||||
if (eventData.button == PointerEventData.InputButton.Left)
|
||||
{
|
||||
this.Press();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000186 RID: 390 RVA: 0x00007BFA File Offset: 0x00005FFA
|
||||
public virtual void OnSubmit(BaseEventData eventData)
|
||||
{
|
||||
this.Press();
|
||||
if (this.IsActive() && this.IsInteractable())
|
||||
{
|
||||
this.DoStateTransition(Selectable.SelectionState.Pressed, false);
|
||||
base.StartCoroutine(this.OnFinishSubmit());
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06000187 RID: 391 RVA: 0x00007C34 File Offset: 0x00006034
|
||||
private IEnumerator OnFinishSubmit()
|
||||
{
|
||||
float fadeTime = base.colors.fadeDuration;
|
||||
float elapsedTime = 0f;
|
||||
while (elapsedTime < fadeTime)
|
||||
{
|
||||
elapsedTime += Time.unscaledDeltaTime;
|
||||
yield return null;
|
||||
}
|
||||
this.DoStateTransition(base.currentSelectionState, false);
|
||||
yield break;
|
||||
}
|
||||
|
||||
// Token: 0x040000BE RID: 190
|
||||
[FormerlySerializedAs("onClick")]
|
||||
[SerializeField]
|
||||
private Button.ButtonClickedEvent m_OnClick = new Button.ButtonClickedEvent();
|
||||
|
||||
// Token: 0x0200003B RID: 59
|
||||
[Serializable]
|
||||
public class ButtonClickedEvent : UnityEvent
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user