diff --git a/Assets/Scripts/OpenTS2/UI/UIButtonComponent.cs b/Assets/Scripts/OpenTS2/UI/UIButtonComponent.cs index 68bd7e1..4ade9a2 100644 --- a/Assets/Scripts/OpenTS2/UI/UIButtonComponent.cs +++ b/Assets/Scripts/OpenTS2/UI/UIButtonComponent.cs @@ -17,7 +17,7 @@ namespace OpenTS2.UI public class UIButtonComponent : UIComponent, IPointerEnterHandler, IPointerExitHandler, IPointerDownHandler, IPointerUpHandler { /// - /// Triggers when this button is clicked. Boolean argument specifies whether it was a double click. + /// Triggers when this button is clicked. /// public Action OnClick; public bool GreyedOut = false; @@ -87,6 +87,7 @@ namespace OpenTS2.UI { if (eventData.button != PointerEventData.InputButton.Left && eventData.button != PointerEventData.InputButton.Right) return; + AudioManager.Instance.PlayUISound(ClickSound); _held = true; } @@ -95,16 +96,8 @@ namespace OpenTS2.UI if (eventData.button != PointerEventData.InputButton.Left && eventData.button != PointerEventData.InputButton.Right) return; if (_held && _hovering) - { - Click(); - } + OnClick?.Invoke(); _held = false; } - - void Click() - { - AudioManager.Instance.PlayUISound(ClickSound); - OnClick?.Invoke(); - } } }