projectEli/Assets/NeoFPS/Samples/Shared/UserInterface/Menus/InGameMenuBackground.cs

29 lines
660 B
C#
Raw Normal View History

2022-11-07 01:28:33 +00:00
using System;
using UnityEngine;
using UnityEngine.EventSystems;
using UnityEngine.UI;
namespace NeoFPS.Samples
{
[HelpURL("http://docs.neofps.com/manual/samples-ui.html")]
public class InGameMenuBackground : Selectable
{
public override void OnPointerDown (PointerEventData eventData)
{
base.OnPointerDown (eventData);
if (EventSystem.current != null)
{
if (MultiInputWidget.lastSelected != null)
EventSystem.current.SetSelectedGameObject (MultiInputWidget.lastSelected.gameObject);
else
{
BaseMenu menu = GetComponentInParent<BaseMenu> ();
if (menu != null)
menu.ResetFocus ();
}
}
}
}
}