Class UITKEquipment
UI Toolkit implementation of the equipment panel.
Binds to UICharacterSheet.uxml / UICharacterSheet.uss and renders the character's
equipped items alongside the attributes they contribute to.
public class UITKEquipment : UITKSlotPanelBase
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKEquipment
- 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
This panel renders the server's answer and never its own guess. Every request it sends leaves the slot looking exactly as it did, marked as waiting, until the equipment container is replicated back — see HandleSlotRightClick(int) for what that replaced and why.
Everything a SLOT does — joining the operation tracker, deciding whether a slot is available, painting the icon and the stack badge and the lock overlay, keeping the tooltip honest, starting a drag, abandoning what is in flight — comes from UITKSlotPanelBase, which this panel shares with the bag and the bank. It used to be a second copy of all of it, eighteen identically named members, and it had drifted from the grid version in three ways; that class records which, and OnSlotPointerDown(PointerDownEvent, int) below carries the one that was a player-visible bug.
What is genuinely this panel's own is the half a socket does differently: its slots are
AUTHORED in UICharacterSheet.uxml rather than built from a container's slot count and a
drop onto one is an equip rather than a swap. Everything else the sheet draws — the ten
sockets' contents, the character preview, the HP / MP / Stamina chips, the attribute rows — is
CharacterSheetView's, which this window shares with the inspect window and which
is why the two now read as one window showing two characters instead of two windows that
happened to be about equipment.
Properties
DragType
The drag and operation-tracker identity of this panel's slots.
protected override ReferenceButtonType DragType { get; }
Property Value
Prefix
Element and USS name prefix for this panel, without a trailing dash.
protected override string Prefix { get; }
Property Value
Remarks
"bank", "inv", "eq". Every panel-specific class name is this prefix plus a fixed suffix, which is what lets the two USS names this class needs be derived rather than declared three times. A panel whose markup does not follow the pattern overrides the names below instead of bending the prefix.
Methods
ApplyPerOpenContent()
Re-reads everything this panel shows from the character, without rebuilding the tree.
protected override void ApplyPerOpenContent()
OnEquipmentSlotLockChanged(IItemContainer, int, bool)
Called when the lock state of an equipment slot changes.
public void OnEquipmentSlotLockChanged(IItemContainer container, int slot, bool isLocked)
Parameters
containerIItemContainerslotintisLockedbool
OnEquipmentSlotUpdated(IItemContainer, Item, int)
Called when an equipment slot's item changes.
public void OnEquipmentSlotUpdated(IItemContainer container, Item item, int equipmentSlot)
Parameters
containerIItemContaineritemItemequipmentSlotint
Remarks
This is the panel's only source of truth about a slot and, for an operation this panel requested, its acknowledgement. Releasing the pending mark here rather than on a reply message is deliberate: what the player is waiting to see is the slot, and the slot arriving IS the reply.
OnPanelDestroying()
Releases the preview camera and texture, the runtime-created attribute elements, and the equipment subscriptions.
protected override void OnPanelDestroying()
Remarks
The tracker subscription and the drag are released by the base before this runs, which is the order this panel already used.
OnPanelHidden()
Hands the preview camera back once the panel has actually gone off screen.
protected override void OnPanelHidden()
Remarks
The camera is handed back rather than simply left enabled, because the preview's cost is
paid every frame whether or not anyone is looking at it. The base decides WHEN this is —
including the Escape and quit-to-login paths, which reach Hide(bool) directly
rather than through Hide() — and abandons the pending marks and any half-finished
drag afterwards. Both used to be spelled out here and in the item grid.
OnPostSetCharacter()
Subscribes to equipment slot events, refreshes all slot visuals, and hands the new character to the sheet.
public override void OnPostSetCharacter()
OnPreSetCharacter()
Unsubscribes from equipment slot events before replacing the character.
public override void OnPreSetCharacter()
OnPreUnsetCharacter()
Drops every subscription and in-flight operation before the character goes away.
public override void OnPreUnsetCharacter()
Remarks
Quit-to-login and a character switch both come through here. Without it the panel keeps its handlers on a character that is being destroyed, keeps equipment slots marked as waiting on a server it is no longer talking to, and can leave a drag armed with a slot index that means something entirely different to the next character.
OnSlotUpdateReceived(int)
Invalidates the preview framing when a socket has changed.
protected override void OnSlotUpdateReceived(int slotIndex)
Parameters
slotIndexint
Remarks
Equipment changes the silhouette: a two-handed weapon reaches further than a dagger, and a frame sized before it existed crops it. Re-framing on the next frame rather than this one is deliberate — the mesh is attached by the visual controller in the same call chain, and measuring before it lands would measure the old silhouette again.
A hook rather than part of the shared update, because it is the one thing a socket update does that a bag-slot update has no equivalent of. It runs only for an update the shared path accepted, which is where it sat before.
OnStarting()
Queries all named elements from the visual tree and wires up button callbacks.
public override void OnStarting()
OnTick()
Refreshes the character preview while the panel is on screen.
protected override void OnTick()
Remarks
The preview is refreshed here rather than on the equipment events because a preview shows an animating character: the idle pose moves every frame, and a texture rendered once when the panel opened would freeze it mid-stride. A frame is also when the viewport's layout first becomes measurable, so this is the hook that gets the preview its size on the opening frame. The base ticks the operation tracker.