Class UITKHotkeyBar
UI Toolkit hotkey bar. Renders the character's hotkey slots as dynamically generated VisualElements and owns their network behaviour: HotkeySetBroadcast / HotkeySetMultipleBroadcast assignment, cooldown sweeps via ICooldownController, drag-assign / drag-clear via the shared UITKDragObject overlay, and Input System activation.
public class UITKHotkeyBar : UITKCharacterControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKHotkeyBar
- Inherited Members
-
MonoBehaviour.IsInvoking()MonoBehaviour.CancelInvoke()MonoBehaviour.StopCoroutine(Coroutine)MonoBehaviour.StopAllCoroutines()MonoBehaviour.destroyCancellationTokenMonoBehaviour.useGUILayoutMonoBehaviour.didStartMonoBehaviour.didAwakeMonoBehaviour.runInEditModeBehaviour.enabledBehaviour.isActiveAndEnabledComponent.GetComponent<T>()Component.TryGetComponent<T>(out T)Component.GetComponentInChildren<T>()Component.GetComponentsInChildren<T>()Component.GetComponentInParent<T>()Component.GetComponentsInParent<T>()Component.GetComponents<T>()Component.GetComponentIndex()Component.CompareTag(TagHandle)Component.transformComponent.transformHandleComponent.gameObjectComponent.tagObject.GetEntityId()Object.GetInstanceID()Object.GetHashCode()Object.InstantiateAsync<T>(T)Object.InstantiateAsync<T>(T, Transform)Object.InstantiateAsync<T>(T, Vector3, Quaternion)Object.InstantiateAsync<T>(T, Transform, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion)Object.Instantiate(Object, Vector3, Quaternion, Transform)Object.Instantiate(Object)Object.Instantiate(Object, Scene)Object.Instantiate<T>(T, InstantiateParameters)Object.Instantiate<T>(T, Vector3, Quaternion, InstantiateParameters)Object.Instantiate(Object, Transform)Object.Instantiate<T>(T)Object.Instantiate<T>(T, Vector3, Quaternion)Object.Instantiate<T>(T, Vector3, Quaternion, Transform)Object.Instantiate<T>(T, Transform)Object.Destroy(Object)Object.DestroyImmediate(Object)Object.DontDestroyOnLoad(Object)Object.DestroyObject(Object)Object.FindObjectsOfType<T>()Object.FindObjectsByType<T>(FindObjectsSortMode)Object.FindObjectsByType<T>(FindObjectsInactive, FindObjectsSortMode)Object.FindObjectOfType<T>()Object.FindFirstObjectByType<T>()Object.FindAnyObjectByType<T>()Object.FindFirstObjectByType<T>(FindObjectsInactive)Object.FindAnyObjectByType<T>(FindObjectsInactive)Object.FindObjectsByType<T>()Object.FindObjectsByType<T>(FindObjectsInactive)Object.ToString()Object.nameObject.hideFlags
Remarks
Model / view split. FishMMO.Client.UITKHotkeyBar.bindings is plain data describing what is bound to
each slot and belongs to the character; FishMMO.Client.UITKHotkeyBar.slots holds the elements currently
rendering it and belongs to ONE visual tree. UIDocument re-clones the UXML on every
enable, so any element cached across a hide/show is a pointer into a discarded tree — the
old code kept its slot state exclusively in those elements and rebuilt them by APPENDING to
a list it never cleared, so a rebuilt tree produced twelve more orphaned slots and a bar
whose bindings had quietly detached from what the player could see.
Change-driven, not per-frame. This panel used to rewrite all twelve slots' icons and
display styles on every single frame from Update — twelve TryGet calls,
twelve dictionary probes and up to twenty-four inline style writes at frame rate for a bar
that changes a handful of times per session. Refreshes are now driven by the events that
can actually invalidate a binding (container slot updates, equip/unequip, ability learned,
hotkey broadcast) and coalesced to at most one sweep per frame.
Properties
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
Methods
OnAfterStarting()
Re-renders the bar from the binding model after the visual tree was rebuilt.
protected override void OnAfterStarting()
OnClientSet()
Registers the hotkey assignment broadcasts when the client connection is set.
public override void OnClientSet()
OnClientUnset()
Unregisters the hotkey assignment broadcasts when the client connection is unset.
public override void OnClientUnset()
OnDestroying()
Unsubscribes from cooldown events when the control is destroyed.
public override void OnDestroying()
OnPostSetCharacter()
Subscribes to the events that can invalidate a hotkey binding.
public override void OnPostSetCharacter()
OnPostUnsetCharacter()
Clears the binding model so one character's bar cannot appear on the next one's.
public override void OnPostUnsetCharacter()
Remarks
The model deliberately outlives the visual tree, which means it also outlives the character unless it is cleared here. A newly selected character with an empty bar generates no hotkey traffic at all, so nothing would ever overwrite the previous character's bindings.
OnPreSetCharacter()
Drops the previous character's subscriptions before a new character is applied.
public override void OnPreSetCharacter()
OnPreUnsetCharacter()
Drops this character's subscriptions before it is cleared.
public override void OnPreUnsetCharacter()
OnQuitToLogin()
Called when the client quits to the login screen. Override to perform cleanup such as stopping coroutines.
public override void OnQuitToLogin()
OnStarting()
Queries the list container, builds the hotkey slots and subscribes to cooldown events.
public override void OnStarting()
Remarks
Runs again on every tree rebuild, so everything here is written to be idempotent: the
slot list is cleared before it is rebuilt, and the static cooldown subscriptions are
removed before they are added. A bare += on a static event from a hook that can
re-run is an unbounded handler leak.
OnTick()
Per-frame hook. Consumes a pending refresh, animates cooldown sweeps and polls input.
protected override void OnTick()
Remarks
This used to be private void Update(). UITKControl declares its own
Update and Unity binds only the MOST DERIVED one, so declaring a second in a
subclass silently killed PollLoseFocus and OnTick for this panel — the
exact failure the base class's own comment warns about.