diff --git a/src/Core/Input/InputSystem.cs b/src/Core/Input/InputSystem.cs index cb1c1bd..78687a0 100644 --- a/src/Core/Input/InputSystem.cs +++ b/src/Core/Input/InputSystem.cs @@ -6,6 +6,7 @@ using UnityEngine.EventSystems; using UnityExplorer.UI; using System.Collections.Generic; using UnityExplorer.UI.Inspectors; +using System.Linq; namespace UnityExplorer.Core.Input { @@ -84,16 +85,28 @@ namespace UnityExplorer.Core.Input } internal static Dictionary ActualKeyDict = new Dictionary(); + internal static Dictionary enumNameFixes = new Dictionary + { + { "Control", "Ctrl" }, + { "Return", "Enter" }, + { "Alpha", "Digit" }, + { "Keypad", "Numpad" }, + { "Numlock", "NumLock" }, + { "Print", "PrintScreen" }, + { "BackQuote", "Backquote" } + }; internal object GetActualKey(KeyCode key) { if (!ActualKeyDict.ContainsKey(key)) { var s = key.ToString(); - if (s.Contains("Control")) - s = s.Replace("Control", "Ctrl"); - else if (s.Contains("Return")) - s = "Enter"; + try + { + if (enumNameFixes.First(it => s.Contains(it.Key)) is KeyValuePair entry) + s = s.Replace(entry.Key, entry.Value); + } + catch { } var parsed = Enum.Parse(TKey, s); var actualKey = m_kbIndexer.GetValue(CurrentKeyboard, new object[] { parsed }); diff --git a/src/ExplorerCore.cs b/src/ExplorerCore.cs index 03f173f..ca646ae 100644 --- a/src/ExplorerCore.cs +++ b/src/ExplorerCore.cs @@ -48,7 +48,7 @@ namespace UnityExplorer Log($"{NAME} {VERSION} initialized."); - InspectorManager.Instance.Inspect(typeof(TestClass)); + //InspectorManager.Instance.Inspect(typeof(TestClass)); } public static void Update()