Table of Contents

Class CancelKey

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

The keys that cancel, close and back out: Escape, and ~ (the backquote key) everywhere except a text field.

public static class CancelKey
Inheritance
CancelKey
Inherited Members

Remarks

~ exists because of the browser. A web build cannot have Escape: it always releases the pointer lock and leaves fullscreen, no page can cancel that, and the browser often does not deliver the key at all. Escape is kept beside it for the desktop client and for the times a browser does pass it through.

While the player is typing, only Escape counts. ~ and ` are characters, and a field that ate them could not hold a password containing one, or a chat line. Typing also means the cursor is already free, which is when a browser lets Escape through.

The same pair is bound in the input asset to Player/Cancel and Player/CloseLastUI, whose handlers apply the same rule through InputControlHasFocus(UITKControl); see PlayerInputController.

Fields

BackquoteControlPath

Input System control path of the ~ key, as bound in PlayerControls.inputactions.

public const string BackquoteControlPath = "<Keyboard>/backquote"

Field Value

string

EscapeControlPath

Input System control path of Escape.

public const string EscapeControlPath = "<Keyboard>/escape"

Field Value

string

Methods

IsInTextField(VisualElement)

True when element is a text input or sits inside one.

public static bool IsInTextField(VisualElement element)

Parameters

element VisualElement

Returns

bool

Remarks

A TextField delegates focus to its inner text element, so a key event targets that child; walking up catches both. Matched by USS class rather than type so every field type (TextField, IntegerField, ...) is covered, and Buttons and Labels — which are TextElements too — are not.

Matches(KeyDownEvent)

True when a key press should cancel: Escape always, ~ unless it was pressed inside a text field.

public static bool Matches(KeyDownEvent evt)

Parameters

evt KeyDownEvent

The key-down event a panel received.

Returns

bool