added text entry system for debug console
This commit is contained in:
parent
e25a691ad9
commit
4375350901
4 changed files with 309 additions and 3 deletions
|
|
@ -157,8 +157,19 @@ namespace TD.UI
|
|||
|
||||
// Set true whenever the chat input or any other text field on the HUD has
|
||||
// keyboard focus. Camera, builder input, and hotkey handlers all gate on
|
||||
// this to keep typing from driving gameplay.
|
||||
public static bool IsTextInputActive { get; private set; }
|
||||
// this to keep typing from driving gameplay. Setter is internal (not
|
||||
// private) so other standalone text-input surfaces — e.g. TD.Dev.DebugConsole,
|
||||
// which is not part of HUDController — can contribute to the same flag
|
||||
// instead of every gameplay script needing to know about every input widget.
|
||||
public static bool IsTextInputActive { get; internal set; }
|
||||
|
||||
// Frame until which chat's "Enter opens chat" behavior is suppressed. Other
|
||||
// standalone text-input surfaces (e.g. TD.Dev.DebugConsole) set this when their
|
||||
// own Enter-driven submit/close already consumed the keypress, so the same
|
||||
// Enter press doesn't also get interpreted as "open chat" this frame. Without
|
||||
// this, submitting a debug console command with Enter would immediately pop
|
||||
// chat open too, since both systems poll the raw key independently.
|
||||
internal static int SuppressChatOpenUntilFrame = -1;
|
||||
|
||||
// ----- State ------------------------------------------------------
|
||||
|
||||
|
|
@ -2017,7 +2028,7 @@ namespace TD.UI
|
|||
|
||||
if (!chatInputOpen)
|
||||
{
|
||||
if (enterDown) OpenChatInput();
|
||||
if (enterDown && Time.frameCount > SuppressChatOpenUntilFrame) OpenChatInput();
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue