Table of Contents

Class UITKCastBar

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

UI Toolkit cast bar bound to the character's ability controller. Displays casting progress and the cast label, and hides itself when the cast completes or is cancelled. Progress is driven as a percentage of the fill element's width.

public class UITKCastBar : UITKCharacterControl
Inheritance
Object
Component
Behaviour
MonoBehaviour
UITKCastBar
Inherited Members
MonoBehaviour.IsInvoking()
MonoBehaviour.CancelInvoke()
MonoBehaviour.StopCoroutine(Coroutine)
MonoBehaviour.StopAllCoroutines()
MonoBehaviour.destroyCancellationToken
MonoBehaviour.useGUILayout
MonoBehaviour.didStart
MonoBehaviour.didAwake
MonoBehaviour.runInEditMode
Behaviour.enabled
Behaviour.isActiveAndEnabled
Component.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.transform
Component.transformHandle
Component.gameObject
Component.tag
Object.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.name
Object.hideFlags

Remarks

The bar is a pure readout of one fact — "an activation is in progress" — and the previous version only ever learned that the fact had stopped being true down ONE of the several routes that can end an activation. It subscribed to OnCancel alone, but AbilityController.ProcessInterrupt fires OnInterrupt and then calls Cancel(state, suppressCancelEvent: true) precisely so that a subscriber to both does not double-handle the end of the cast — so a bar listening only to the suppressed event was left on screen after every single interrupt, filled to whatever fraction the cast had reached, until the next cast overwrote it.

The other routes are just as real and none of them raise OnCancel either: a reply the server never sends (OnUpdate simply stops arriving), the character dying, the ability being denied after the client already predicted it, a zone change, and quit-to-login. Rather than enumerate hide-triggers one by one and hope the list is complete, this panel keeps a FishMMO.Client.UITKCastBar.lastUpdateTime stamp and treats "no progress report for FishMMO.Client.UITKCastBar.CastTimeoutSeconds seconds" as the catch-all: any end-of-cast nobody explicitly told us about still closes the bar within a bounded time.

Properties

Layer

Draw order tier for this panel. See UITKPanelLayer.

protected override UITKPanelLayer Layer { get; }

Property Value

UITKPanelLayer

Methods

AbilityController_OnAbilityDenied(long)

Handles the server denying an ability this client already began predicting.

public void AbilityController_OnAbilityDenied(long abilityID)

Parameters

abilityID long

The denied ability's reference ID.

AbilityController_OnCancel()

Handles ability cancel by hiding the cast bar.

public void AbilityController_OnCancel()

AbilityController_OnInterrupt()

Handles ability interrupt by hiding the cast bar.

public void AbilityController_OnInterrupt()

Remarks

The reason this subscription has to exist: ProcessInterrupt suppresses OnCancel on the interrupt path, so a panel listening only to cancel never learns that the cast ended.

AbilityController_OnReset()

Handles a full ability-state reset (character reload / re-sync) by hiding the bar.

public void AbilityController_OnReset()

AbilityController_OnUpdate(string, float, float)

Updates the cast bar fill and label based on the remaining and total cast time.

public void AbilityController_OnUpdate(string label, float remainingTime, float totalTime)

Parameters

label string

The cast label to display.

remainingTime float

The remaining cast time.

totalTime float

The total cast time.

OnAfterShow()

Called at the end of Show(), against the tree the player will actually see. Override to write content that changes from one opening to the next.

protected override void OnAfterShow()

Remarks

This exists because "set the text, then Show" does not work and fails silently. UnityEngine.UIElements.UIDocument clones the UXML on enable, so a panel that fills in its message, list rows or icon before calling Show() writes into a tree that is thrown away microseconds later, and the player sees whatever the UXML declares — an empty dialog, a blank tooltip, a selector with no rows.

Distinct from OnAfterStarting(), which re-applies state after the tree is rebuilt. This one runs on every show, rebuilt tree or not.

OnAfterStarting()

Re-applies the character once the visual tree exists.

protected override void OnAfterStarting()

Remarks

World entry calls FishMMO.Client.UIManager.SetCharacter(FishMMO.Shared.Core.IPlayerCharacter) for every control at once, and a control that starts hidden has no visual tree until something shows it — so OnPostSetCharacter() can run before OnStarting has cached any elements. Overrides that write into those elements would then dereference null, and even a null-safe one would leave the panel showing nothing, because the only call that had data already happened. Running it again here is what makes the two orders equivalent.

OnDestroying()

Releases the global lifecycle subscriptions.

public override void OnDestroying()

OnPostSetCharacter()

Subscribes to ability controller cast update, cancel, interrupt, deny and reset events.

public override void OnPostSetCharacter()

Remarks

UITKCharacterControl.OnAfterStarting calls OnPreSetCharacter() then OnPostSetCharacter() on every tree rebuild so the pair cancels out. The unsubscribe therefore has to live in the PRE hook, not only in the unset hook, or each rebuild adds another copy of every handler.

OnPreSetCharacter()

Unsubscribes from the outgoing character's ability controller before a new one is set.

public override void OnPreSetCharacter()

OnPreUnsetCharacter()

Unsubscribes from ability controller events and hides the cast bar before the character changes.

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 fill and label elements from the document root.

public override void OnStarting()

OnTick()

Closes a cast bar whose activation stopped reporting progress.

protected override void OnTick()

Remarks

This is the catch-all for every ending nobody announced: a server reply that never arrived, a despawn, a scene server hand-off mid-cast. Uses unscaledTime so a paused or time-scaled client still recovers.