From 40e2236f121e454e7dcc48b675b59384efdb07ed Mon Sep 17 00:00:00 2001 From: Brajanowski Date: Tue, 21 Oct 2025 15:24:31 +0200 Subject: [PATCH] improvements to input service --- README.md | 18 +- .../Engine/Code/ConsoleUI/ConsoleUIService.cs | 20 ++- Runtime/Engine/Code/ConsoleUI/ConsoleVC.cs | 13 +- Runtime/Engine/Code/Input/InputService.cs | 159 ++++++++++++++---- 4 files changed, 151 insertions(+), 59 deletions(-) diff --git a/README.md b/README.md index b9c47a1..6401211 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,6 @@ # RebootKit -# Installationa (WIP) - -### nuget - -Install nuget package manager for unity from the unity package manager. -And install the following packages: -- **R3** by Cysharp -- **ZLinq** by Cysharp +# Installation (WIP) ### manifest.json Ensure you have the following dependencies in your `Packages/manifest.json` file: @@ -15,17 +8,8 @@ Ensure you have the following dependencies in your `Packages/manifest.json` file ```json { "dependencies": { - "com.cysharp.r3": "https://github.com/Cysharp/R3.git?path=src/R3.Unity/Assets/R3.Unity", "com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask", - "com.cysharp.zlinq": "https://github.com/Cysharp/ZLinq.git?path=src/ZLinq.Unity/Assets/ZLinq.Unity", - "com.github-glitchenzo.nugetforunity": "https://github.com/GlitchEnzo/NuGetForUnity.git?path=/src/NuGetForUnity", } } ``` -# TODO -- [ ] Save system -- [ ] Built in main menu -- [ ] Generic settings ui based on Config Variables -- [ ] Extendable FPP Controller -- [ ] UI System diff --git a/Runtime/Engine/Code/ConsoleUI/ConsoleUIService.cs b/Runtime/Engine/Code/ConsoleUI/ConsoleUIService.cs index e16e47f..3259eb7 100644 --- a/Runtime/Engine/Code/ConsoleUI/ConsoleUIService.cs +++ b/Runtime/Engine/Code/ConsoleUI/ConsoleUIService.cs @@ -12,15 +12,28 @@ namespace RebootKit.Engine.ConsoleUI { [SerializeField] ConsoleVC m_ConsoleVC; [SerializeField] ScriptableInputAction m_ToggleAction; + + InputState m_InputState; readonly StringBuilder m_Content = new StringBuilder(); public bool IsVisible => m_ConsoleVC.gameObject.activeSelf; void Awake() { + m_InputState = RR.Input.NewInputState("ConsoleUI"); + m_InputState.Priority = int.MaxValue; + m_InputState.LockCursor = false; + m_InputState.HideCursor = false; + m_InputState.IsActive = IsVisible; + SetVisibility(false); } + void OnDestroy() { + m_InputState?.Dispose(); + m_InputState = null; + } + void OnEnable() { s_Logger.Info("OnEnable console"); @@ -47,13 +60,7 @@ namespace RebootKit.Engine.ConsoleUI { SetVisibility(!IsVisible); if (IsVisible) { - RR.Input.DisableControls(); - RR.Input.UnlockCursor(); - m_ConsoleVC.SetMessageContent(m_Content.ToString()); - } else { - RR.Input.EnableControls(); - RR.Input.LockCursor(); } } @@ -64,6 +71,7 @@ namespace RebootKit.Engine.ConsoleUI { public void SetVisibility(bool visible) { m_ConsoleVC.gameObject.SetActive(visible); + m_InputState.IsActive = visible; } public void Write(string message) { diff --git a/Runtime/Engine/Code/ConsoleUI/ConsoleVC.cs b/Runtime/Engine/Code/ConsoleUI/ConsoleVC.cs index 7bcb82b..df123f7 100644 --- a/Runtime/Engine/Code/ConsoleUI/ConsoleVC.cs +++ b/Runtime/Engine/Code/ConsoleUI/ConsoleVC.cs @@ -5,7 +5,7 @@ using Logger = RebootKit.Engine.Foundation.Logger; namespace RebootKit.Engine.ConsoleUI { public class ConsoleVC : MonoBehaviour { - static readonly Logger s_logger = new Logger(nameof(ConsoleVC)); + static readonly Logger s_Logger = new Logger(nameof(ConsoleVC)); [SerializeField] UIDocument m_Document; @@ -21,14 +21,13 @@ namespace RebootKit.Engine.ConsoleUI { m_LabelMessage = m_Root.Q