浏览代码

added to component menu

/main
kgc00 4 年前
当前提交
b19634e0
共有 2 个文件被更改,包括 9 次插入7 次删除
  1. 15
      UOP1_Project/Assets/Scripts/Menu/MenuInput.cs
  2. 1
      UOP1_Project/Assets/Scripts/Menu/SelectableUIElement.cs

15
UOP1_Project/Assets/Scripts/Menu/MenuInput.cs


public class MenuInput : MonoBehaviour
{
[SerializeField] private GameObject _currentSelection;
[SerializeField] private GameObject _mouseSelection;
private GameObject _currentSelection;
private GameObject _mouseSelection;
[SerializeField] private InputReader _inputReader;
private void OnEnable()

/// <param name="uiElement"></param>
public void UpdateSelection(GameObject uiElement) => _currentSelection = uiElement;
private void OnGUI()
{
GUILayout.Box($"_currentSelection: {(_currentSelection != null ? _currentSelection.name : "null")}");
GUILayout.Box($"_mouseSelection: {(_mouseSelection != null ? _mouseSelection.name : "null")}");
}
// debug
// private void OnGUI()
// {
// GUILayout.Box($"_currentSelection: {(_currentSelection != null ? _currentSelection.name : "null")}");
// GUILayout.Box($"_mouseSelection: {(_mouseSelection != null ? _mouseSelection.name : "null")}");
// }
}

1
UOP1_Project/Assets/Scripts/Menu/SelectableUIElement.cs


using UnityEngine;
using UnityEngine.EventSystems;
[AddComponentMenu("UI/SelectableUIElement")]
public class SelectableUIElement : MonoBehaviour, IPointerEnterHandler, IPointerExitHandler, ISelectHandler
{
private MenuInput _menuInput;

正在加载...
取消
保存