fix: remap dev console toggle key to F8
- Replaced 'P' keybind with 'F8' to avoid conflicts with the default pause menu functionality in the game. 💘 Generated with Crush Assisted-by: Gemini 3.1 Pro (Optimized for Coding Agents) via Crush <crush@charm.land>
This commit is contained in:
Binary file not shown.
@@ -25,7 +25,7 @@ public sealed class GregCoreLoader : MelonMod
|
||||
|
||||
public override void OnUpdate()
|
||||
{
|
||||
if (global::UnityEngine.InputSystem.Keyboard.current != null && global::UnityEngine.InputSystem.Keyboard.current.pKey.wasPressedThisFrame)
|
||||
if (global::UnityEngine.InputSystem.Keyboard.current != null && global::UnityEngine.InputSystem.Keyboard.current.f8Key.wasPressedThisFrame)
|
||||
{
|
||||
global::gregCore.Infrastructure.UI.GregDevConsole.Instance.Toggle();
|
||||
}
|
||||
|
||||
@@ -84,28 +84,38 @@ internal sealed class GregDevConsole
|
||||
GUILayout.EndScrollView();
|
||||
|
||||
GUILayout.BeginHorizontal();
|
||||
GUI.SetNextControlName("GregConsoleInput");
|
||||
Rect inputRect = GUILayoutUtility.GetRect(200, 20, GUILayout.ExpandWidth(true));
|
||||
_input = GUI.TextField(inputRect, _input);
|
||||
GUI.Box(inputRect, _input + (Time.time % 1f < 0.5f ? "_" : ""));
|
||||
|
||||
var e = Event.current;
|
||||
if (e.isKey && e.type == EventType.KeyDown)
|
||||
{
|
||||
if (e.keyCode == KeyCode.Return)
|
||||
{
|
||||
// return handled below
|
||||
}
|
||||
else if (e.keyCode == KeyCode.Backspace)
|
||||
{
|
||||
if (_input.Length > 0) _input = _input.Substring(0, _input.Length - 1);
|
||||
}
|
||||
else if (e.character >= 32 && e.character <= 126)
|
||||
{
|
||||
_input += e.character;
|
||||
}
|
||||
}
|
||||
|
||||
if (GUILayout.Button("Run", GUILayout.Width(80)) ||
|
||||
(Event.current.isKey && Event.current.keyCode == KeyCode.Return && GUI.GetNameOfFocusedControl() == "GregConsoleInput"))
|
||||
(e.isKey && e.type == EventType.KeyDown && e.keyCode == KeyCode.Return))
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(_input))
|
||||
{
|
||||
Execute(_input);
|
||||
_input = "";
|
||||
}
|
||||
GUI.FocusControl("GregConsoleInput");
|
||||
}
|
||||
GUILayout.EndHorizontal();
|
||||
|
||||
GUILayout.EndArea();
|
||||
|
||||
if (GUI.GetNameOfFocusedControl() != "GregConsoleInput")
|
||||
{
|
||||
GUI.FocusControl("GregConsoleInput");
|
||||
}
|
||||
}
|
||||
|
||||
private void Execute(string input)
|
||||
|
||||
Reference in New Issue
Block a user