Table of Contents

Class UITKResourceBar

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Abstract UI Toolkit resource bar (health/mana/stamina) bound to a character attribute. The value is rendered as a fill VisualElement whose width is a percentage of the bar, and smoothly interpolates toward the target value to avoid jitter from prediction corrections.

public abstract class UITKResourceBar : UITKCharacterControl
Inheritance
Object
Component
Behaviour
MonoBehaviour
UITKResourceBar
Derived
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.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.name
Object.hideFlags

Fields

SmoothSpeed

How fast the fill interpolates toward the target value (fraction per second).

[Tooltip("Interpolation speed for the bar fill (fraction per second).")]
public float SmoothSpeed

Field Value

float

SnapThreshold

When the difference between the displayed and target fraction exceeds this threshold, the fill snaps instantly instead of interpolating (e.g., death or resurrection).

[Tooltip("If the change exceeds this fraction (0-1), the fill snaps instantly.")]
public float SnapThreshold

Field Value

float

TemplateID

The attribute template ID used to identify which resource this bar represents.

[TemplateReference(typeof(CharacterAttributeTemplate))]
public int TemplateID

Field Value

int

Properties

CanDrag

The player may drag this bar, so the row above the hotkey bar is a starting point rather than the only place it can live.

protected override bool CanDrag { get; }

Property Value

bool

Remarks

The HUD is not draggable by default — see UITKControl.CanDrag — and the three bars are the exception to that, along with the buff and debuff strips. Each bar has no header, so the bar itself is the handle; it is 200x14 and carries no controls, so there is nothing on it a press could have meant instead.

Where a player leaves one is kept per panel name in UITKPanelPositions, snapping to the same grid the rest of the HUD uses. The three bars are placed by .res-bar--hp/mp/stam in one row and nothing else, so a bar that has been dragged keeps its position across a relog while the two it did not touch stay in the row.

Dragging one out of the row is a supported arrangement rather than a mess to tidy up: the stylesheet anchors each bar by its absolute left and by the BOTTOM edge so the block tracks the hotkey bar, and UITKControl.SetDragPosition releases that edge when it writes an absolute left/top.

FillModifierClass

USS modifier class applied to the fill element to colour this bar (e.g. "fish-bar__fill--hp"). Supplied by the concrete subclass.

protected abstract string FillModifierClass { get; }

Property Value

string

Layer

Draw order tier for this panel. See UITKPanelLayer.

protected override UITKPanelLayer Layer { get; }

Property Value

UITKPanelLayer

RootModifierClass

USS modifier class applied to the bar root to place it on screen (e.g. "res-bar--hp"). Supplied by the concrete subclass.

protected abstract string RootModifierClass { get; }

Property Value

string

Remarks

Each bar owns a separate UnityEngine.UIElements.UIDocument, so the three of them cannot be laid out relative to one another by a shared container — every panel root fills the screen independently. Without a per-bar anchor they all resolve to the same strip and draw on top of each other, leaving only whichever panel sorts last visible.

RowSlot

This bar's place in the default row: -1 left of centre, 0 centred, +1 right of centre.

protected abstract int RowSlot { get; }

Property Value

int

Methods

CharacterAttribute_OnAttributeUpdated(CharacterAttribute)

Updates the target fraction and the value label when the resource attribute changes.

public void CharacterAttribute_OnAttributeUpdated(CharacterAttribute attribute)

Parameters

attribute CharacterAttribute

The updated character attribute.

OnDestroying()

Drops the hotbar settings subscription, which is static and would hold this panel.

public override void OnDestroying()

OnPostSetCharacter()

Subscribes to the resource attribute and snaps the bar to the initial value.

public override void OnPostSetCharacter()

OnPreSetCharacter()

Unsubscribes from the resource attribute and refreshes once before the character changes.

public override void OnPreSetCharacter()

OnPreUnsetCharacter()

Unsubscribes from the outgoing character's resource attribute before it is cleared.

public override void OnPreUnsetCharacter()

Remarks

This override was missing, and OnPreSetCharacter() could not cover for it: that one unsubscribes from whatever Character still holds, so once the unset path had nulled the field the old attribute's subscription was unreachable and stayed live forever. One more leaked handler per logout, each of them still writing the previous character's health into a bar the next character is looking at.

OnStarting()

Queries the fill and label elements and applies the colour modifier class.

public override void OnStarting()

OnTick()

Smoothly interpolates the fill width toward the target value each frame.

protected override void OnTick()

Remarks

This was private void Update(). UITKControl declares its own Update and Unity binds only the MOST DERIVED one, so a second Update in a subclass silently disables PollLoseFocus and OnTick for the whole panel — the failure the base class's own comment warns about, and it was live on all three resource bars.