projectEli/Assets/NeoFPS/Samples/Shared/UserInterface/MultiInputWidgets/MultiInputFocusableWidget.cs
2022-11-06 20:28:33 -05:00

29 lines
626 B
C#

using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace NeoFPS.Samples
{
public abstract class MultiInputFocusableWidget : MultiInputWidget, ISubmitHandler
{
public virtual void OnSubmit (BaseEventData eventData)
{
if (widgetState == WidgetState.Highlighted)
{
currentlyFocussed = this;
widgetState = WidgetState.Focussed;
PlayAudio (MenuAudio.ClickValid);
}
}
public override void OnPointerUp (PointerEventData eventData)
{
base.OnPointerUp (eventData);
// Remove focus (used for keyboard / gamepad input only)
RemoveFocus ();
}
}
}