using System; using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.Events; using UnityEngine.InputSystem; namespace Ichni.Menu { public class MenuInputManager : MonoBehaviour { public static MenuInputManager instance; public GameInput gameInput; public PlayerInput playerInput; public static event UnityAction OnMoveUp; public static event UnityAction OnMoveDown; private void Awake() { instance = this; gameInput = new GameInput(); gameInput.Menu.Enable(); RegisterActionsInputs(); } private void RegisterActionsInputs() { gameInput.Menu.Up.performed += ctx => { if (ctx.performed) { OnMoveUp?.Invoke(); } }; gameInput.Menu.Down.performed += ctx => { if (ctx.performed) { OnMoveDown?.Invoke(); } }; gameInput.Menu.Scroll.performed += ctx => { if (ctx.performed) { float scrollValue = ctx.ReadValue(); if (scrollValue > 0) { OnMoveUp?.Invoke(); } else if (scrollValue < 0) { OnMoveDown?.Invoke(); } } }; } } }