Table of Contents

Class UIManager

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Registry and lifecycle helper for the client's UI Toolkit panels.

public static class UIManager
Inheritance
UIManager
Inherited Members

Remarks

Every panel registers itself by GameObject name in UITKControl's Awake, and the rest of the client reaches it through that name — TryGetTK("UIChat", …), ToggleVisibility("UIInventory"). Nothing holds direct references between panels.

There is exactly one registry per lookup. A second, parallel set for a different panel hierarchy used to sit in front of these, and every generic entry point checked it first and fell through with else if — so wherever a name existed in both, one panel was silently unreachable. Keep the lookups single-path.

Methods

AnyCursorReleasingVisible()

True while any visible panel needs the mouse cursor.

public static bool AnyCursorReleasingVisible()

Returns

bool

True when at least one visible panel has ReleasesCursor set.

Remarks

PlayerInputController asks this before recapturing the cursor for gameplay. It used to ask CloseNext(bool) instead, treating "is anything Escape-closable" as a stand-in for "is anything on screen that needs clicking" — which forced every panel wanting the cursor to also be Escape-closable, and made a confirm dialog dismissable with Escape when the whole point of it was to make the player choose.

CloseNext(bool)

Closes the most recently opened Escape-closable panel, if any.

public static bool CloseNext(bool peakOnly = false)

Parameters

peakOnly bool

If true, only reports whether one is available without closing it.

Returns

bool

True if a control was closed or is available to close.

Remarks

PlayerInputController recaptures the mouse cursor on every frame where this returns false, so a panel missing from the list releases the cursor in Show() and has it taken back before the player can click anything — the whole symptom of "the menu opens but nothing is clickable".

ClosedAll()

Checks if every Escape-closable panel has been closed.

public static bool ClosedAll()

Returns

bool

True if nothing is left to close.

ControlHasFocus(UITKControl)

Checks if any control has focus, optionally ignoring a specific control.

public static bool ControlHasFocus(UITKControl ignore = null)

Parameters

ignore UITKControl

An optional control to ignore in the check.

Returns

bool

True if any control has focus, false otherwise.

Exists(string)

Checks whether a control with the given name is registered.

public static bool Exists(string name)

Parameters

name string

The name of the control.

Returns

bool

True if a control is registered under that name.

Hide(string)

Hides a control by name.

public static void Hide(string name)

Parameters

name string

The name of the control.

HideAll()

Hides all registered controls.

public static void HideAll()

InputControlHasFocus(UITKControl)

Checks if any input control has focus, optionally ignoring a specific control.

public static bool InputControlHasFocus(UITKControl ignore = null)

Parameters

ignore UITKControl

An optional control to ignore in the check.

Returns

bool

True if any input control has focus, false otherwise.

Remarks

This is the gate PlayerInputController puts in front of movement input. If it ever stops seeing a panel, typing into that panel's text field also drives the character — every letter bound to a movement key moves the player mid-sentence.

InputControlHasFocus(string)

Checks if a specific input control has focus.

public static bool InputControlHasFocus(string name)

Parameters

name string

The name of the control.

Returns

bool

True if the control is an input field and has focus, false otherwise.

IsCoveredByHigherPanel(UITKControl)

True when another visible, input-accepting panel is drawn above control.

public static bool IsCoveredByHigherPanel(UITKControl control)

Parameters

control UITKControl

The panel asking whether it is still the one in front.

Returns

bool

True when something covers it.

Remarks

This is the guard the login-flow keyboard shortcuts sit behind. UI Toolkit routes a key press to the focused element and up its own ancestors only, so a panel normally cannot see keys meant for another one — but nothing moves focus when a panel opens over another. Opening Options from the sign-in screen is the case that bit: Options draws on top and takes no focus, so the caret stayed in the password field behind it and pressing Enter signed the player in through a panel they could no longer see.

Decided on draw order rather than on layer so that two panels sharing a layer — which BringToFront() separates by a focus offset — still resolve to exactly one front-most panel. Panels that do not accept pointer input are ignored; see FishMMO.Client.UITKControl.AcceptsPointerInput.

ReloadAllPanelPositions()

Re-reads every panel's stored position and moves the live panels to match.

public static void ReloadAllPanelPositions()

Remarks

For the case where the stored positions changed underneath the panels rather than because of them — loading a shared UI profile is the only one today. Panels read their position once, on first layout, so writing new coordinates into configuration alone has no visible effect until the client restarts.

Isolated per panel, as ResetAllPanelPositions() is and for the same reason: one panel that throws must not strand the rest halfway through somebody else's layout.

ResetAllPanelPositions()

Puts every panel back where its stylesheet places it and forgets the player's saved arrangement.

public static void ResetAllPanelPositions()

Remarks

The escape hatch for a layout the player cannot fix by dragging — a panel moved to a corner of a monitor they no longer have, or an arrangement they simply want back. Offered from the options screen.

Isolated per panel for the reason FishMMO.Client.UIManager.SetCharacter(FishMMO.Shared.Core.IPlayerCharacter) documents: this is a recovery action, and one panel that throws on the way must not stop the rest from being recovered.

Show(string)

Shows a control by name.

public static void Show(string name)

Parameters

name string

The name of the control.

ShowAll()

Shows all registered controls.

public static void ShowAll()

ToggleVisibility(string)

Toggles the visibility of a control.

public static void ToggleVisibility(string name)

Parameters

name string

The name of the control.

TryGetTK<T>(string, out T)

Tries to retrieve a panel by name and cast it to the specified type.

public static bool TryGetTK<T>(string name, out T control) where T : UITKControl

Parameters

name string

The name of the control.

control T

The retrieved control, if found.

Returns

bool

True if the control was found and cast successfully, false otherwise.

Type Parameters

T

The control subtype to cast to.