Class UITKEquipment
UI Toolkit implementation of the equipment panel.
Binds to UIEquipment.uxml / UIEquipment.uss and renders the character's
equipped items alongside the attributes they contribute to.
public class UITKEquipment : UITKCharacterControl
- 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.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.
Methods
Hide(bool)
Hides the equipment panel, disables the preview camera and abandons anything this panel had in flight.
public override void Hide(bool overrideIsAlwaysOpen)
Parameters
overrideIsAlwaysOpenboolWhen true, the call is a no-op.
Remarks
Hide(bool) and not Hide(): Hide() delegates here, but Escape
(UIManager.CloseNext) and quit-to-login (Hide(false)) both arrive at this
overload directly. A pending mark or a half-finished drag that outlives the panel is
invisible to the player and refuses their next click for no stated reason.
OnAfterShow()
Re-applies per-open content on every show, including the very first one.
protected override void OnAfterShow()
Remarks
OnAfterStarting alone is not enough, and this is the trap THE CONTRACT warns
about: on the first ever open hasStarted is still false, so
ReinitializeIfTreeReplaced returns before re-running it. Doing the work from
both hooks is what makes the first open behave like every later one. Both paths are
idempotent — this re-reads state and repaints, it does not accumulate anything.
OnAfterStarting()
Re-applies per-open content after the visual tree has been rebuilt.
protected override void OnAfterStarting()
Remarks
The base implementation re-runs the character pre/post pair, which repopulates the slots and attribute rows. What it does not carry across is the pending marks, which live in the shared tracker rather than in the tree, so they have to be repainted onto the new elements here.
OnAttributeUpdated(CharacterAttribute)
Refreshes the attribute label for an updated attribute.
public void OnAttributeUpdated(CharacterAttribute attribute)
Parameters
attributeCharacterAttribute
OnClientSet()
Registers with the shared item-operation tracker.
public override void OnClientSet()
OnClientUnset()
Detaches from the shared item-operation tracker.
public override void OnClientUnset()
OnDestroying()
Cleans up the camera reference, runtime-created attribute elements and every subscription this panel holds.
public override void OnDestroying()
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.
OnPostSetCharacter()
Subscribes to equipment slot events, refreshes all slot visuals, and builds the attribute row list for the newly set character.
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.
OnStarting()
Queries all named elements from the visual tree and wires up button callbacks.
public override void OnStarting()
OnTick()
Times out item operations whose reply never arrived.
protected override void OnTick()
Remarks
The tracker is shared and self-clearing, so it does not matter that all three item panels drive it; whichever ticks first in a frame does the work and the others find nothing outstanding.
SetEquipmentViewCamera(Camera)
Assigns the camera used for the 3D character preview viewport. Pass null to clear the reference.
public void SetEquipmentViewCamera(Camera camera)
Parameters
cameraCameraCamera to use for preview rendering.
SetPreviewRenderTexture(RenderTexture)
Assigns a RenderTexture to the preview-rt element so the camera feed is visible inside the UXML viewport.
public void SetPreviewRenderTexture(RenderTexture rt)
Parameters
rtRenderTextureThe render texture to display.
Show()
Shows the equipment panel and enables the equipment-view camera if assigned.
public override void Show()
ToggleVisibility()
Toggles the panel and syncs the camera accordingly.
public override void ToggleVisibility()