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.MemberwiseClone()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. A UIDocument that is
disabled and re-enabled clones the UXML afresh (hiding used to do that on every hide/show),
so a dictionary of elements cached across that points into a discarded tree and the strip
comes back permanently empty.
Dismissal. A click on an icon asks the server to take that buff off the character — see DismissBuffBroadcast. Whether the ask is even made, whether the tooltip advertises it, and whether the server honours it are all the same expression, CanBeDismissedByPlayer. This strip is the owner's own, so nothing here removes another character's buff.
Properties
CanDrag
The player may drag this strip to a corner or edge of their choosing.
protected override bool CanDrag { get; }
Property Value
Remarks
The HUD is not draggable by default — see UITKControl.CanDrag — and both strips are the exception to that. They have no header, so the strip itself is the handle and it stays safe to drag from: a press that does not move is still a click on the buff under it, which is what removes a removable buff.
The stylesheet's anchor is the default the player starts from, not a fixed position — UITKControl writes an absolute left/top on the first drag, releases the `right` the debuff strip is anchored by, and keeps the result in UITKPanelPositions under this panel's name.
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
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
Panels keep their tree across hide and show, so an element written while hidden still holds that value when shown. This is the place for content that should be current at the moment of opening, and for resetting anything a fresh opening should not inherit from the last one: typed text, a pending confirmation, a leftover error.
Distinct from OnAfterStarting(), which runs once when the panel starts and again only if its tree is ever genuinely rebuilt. This one runs on every show.
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 if the tree is ever replaced, 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()