您最多选择25个主题
主题必须以中文或者字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符
29 行
692 B
29 行
692 B
using System;
|
|
using UnityEngine;
|
|
using UnityEngine.EventSystems;
|
|
|
|
[AddComponentMenu("UI/SelectableUIElement")]
|
|
public class SelectableUIElement : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler
|
|
{
|
|
private MenuSelectionHandler _menuInput;
|
|
|
|
private void Awake()
|
|
{
|
|
_menuInput = transform.root.gameObject.GetComponentInChildren<MenuSelectionHandler>();
|
|
}
|
|
|
|
public void OnPointerEnter(PointerEventData eventData)
|
|
{
|
|
_menuInput.HandleMouseEnter(gameObject);
|
|
}
|
|
|
|
public void OnPointerExit(PointerEventData eventData)
|
|
{
|
|
_menuInput.HandleMouseExit(gameObject);
|
|
}
|
|
|
|
public void OnSelect(BaseEventData eventData)
|
|
{
|
|
_menuInput.UpdateSelection(gameObject);
|
|
}
|
|
}
|