Class UITKBuffContainer
Abstract UI Toolkit container that renders a horizontal strip of buff or debuff icons, each with a depleting duration fill. Buff groups are built dynamically as VisualElements, so no prefab reference is required.
public abstract class UITKBuffContainer : UITKCharacterControl
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKBuffContainer
- Derived
- 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
Owner scoping. The five buff lifecycle events on IBuffController are STATIC — one invocation list for the whole process — and used to carry only the Buff, which has no owner. Every buff applied to every NPC, pet, summon and other player in view was therefore delivered here and rendered onto the LOCAL player's own strips. It was easy to miss because groups are keyed by template ID, so N mobs carrying the same debuff collapsed into one icon that looked plausible; a debuff landing on a mob really did appear on the player, and expired off the player when it expired on the mob.
The events now carry the owning controller and every handler here compares it against this panel's character before doing anything. A static event cannot be scoped at subscription time, so the filter has to live in the callback.
Model / view split. FishMMO.Client.UITKBuffContainer.entries is plain data owned by the character;
FishMMO.Client.UITKBuffContainer.groups holds the elements of ONE visual tree. UIDocument re-clones the
UXML on every enable, so a dictionary of elements cached across a hide/show points into a
discarded tree and the strip comes back permanently empty.
Properties
IsDebuff
True for the debuff container, false for the buff container.
protected abstract bool IsDebuff { get; }
Property Value
Layer
Draw order tier for this panel. See UITKPanelLayer.
protected override UITKPanelLayer Layer { get; }
Property Value
TooltipHint
Extra tooltip hint appended for interactive (removable) buffs, if any.
protected virtual string TooltipHint { get; }
Property Value
Methods
AddBuffGroup(IBuffController, Buff)
Builds and registers a buff group for the supplied buff if not already present.
protected void AddBuffGroup(IBuffController buffController, Buff buff)
Parameters
buffControllerIBuffControllerThe controller the buff belongs to.
buffBuffThe buff to add.
ClearAll()
Removes all rendered buff groups and forgets the model.
protected void ClearAll()
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()
Rebuilds the strip from the model after the visual tree was replaced.
protected override void OnAfterStarting()
OnDestroying()
Unsubscribes from buff lifecycle events and clears all rendered groups.
public override void OnDestroying()
OnPostSetCharacter()
Seeds the strip from the character's current buffs when a character is applied.
public override void OnPostSetCharacter()
Remarks
Without this the strip only ever learned about buffs applied AFTER it was bound, so a buff that survived a relog or a scene change (they are persisted, and restored from the spawn payload) was active on the character and invisible on the bar.
OnPostUnsetCharacter()
Clears the strip when the character is removed, so one character's buffs cannot appear on the next one's bar.
public override void OnPostUnsetCharacter()
OnQuitToLogin()
Clears all rendered groups when quitting to the login screen.
public override void OnQuitToLogin()
OnStarting()
Queries the list container and subscribes to buff lifecycle events.
public override void OnStarting()
Remarks
Re-runs on every tree rebuild, so the element dictionary is dropped first (those
elements belong to the discarded tree) and every static subscription is removed before
it is added. A bare += from a hook that can re-run leaks handlers without bound.
RemoveBuffGroup(IBuffController, Buff)
Removes and disposes the buff group for the supplied buff.
protected void RemoveBuffGroup(IBuffController buffController, Buff buff)
Parameters
buffControllerIBuffControllerThe controller the buff belongs to.
buffBuffThe buff to remove.
SubscribeAddRemove()
Subscribes the concrete container to its specific add/remove events.
protected abstract void SubscribeAddRemove()
UnsubscribeAddRemove()
Unsubscribes the concrete container from its specific add/remove events.
protected abstract void UnsubscribeAddRemove()