improvements to input service
This commit is contained in:
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user