Class UITKInventory
UI Toolkit implementation of the inventory panel.
public class UITKInventory : UITKItemGridPanel
- Inheritance
-
ObjectComponentBehaviourMonoBehaviourUITKInventory
- 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
The grid, its slots, drag-and-drop, tooltips and the capacity readout all live in UITKItemGridPanel, which the bank shares. What is left here is what is actually particular to a backpack: a move into it is an inventory swap and right-clicking an item wears it.
Moving an item is a PRESS to pick it up and a PRESS to put it down. A release does nothing
here or in any other panel — the note above Notify in UITKSlotPanelBase
says why, because this class used to be the one that completed a drop on the release.
Properties
DragType
The drag and operation-tracker identity of this panel's slots.
protected override ReferenceButtonType DragType { get; }
Property Value
OwnInventoryType
This panel's container, as the server names it in a request.
protected override InventoryType OwnInventoryType { 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.
QuickTransferTarget
The container a shift-click sends an item to, or null when this panel has nowhere to send one.
protected override ReferenceButtonType? QuickTransferTarget { get; }
Property Value
Methods
HandleSlotRightClick(int)
Right-click wears the item if it can be worn, and otherwise offers to split it.
protected override void HandleSlotRightClick(int slotIndex)
Parameters
slotIndexint
Remarks
InventoryController.Activate is the "use this item" path and it does nothing at
all today — its body is a log line and a commented-out OnUseItem, and the server has no
matching handler — so right-clicking an item was silently doing nothing. Equipping is
the behaviour the slot actually needs, and the broadcast for it already exists and is
already handled server-side; the equipment panel has been sending it for click-to-drop
all along. The destination slot comes from the item's own template, which is what makes
a single right-click meaningful: a breastplate has exactly one slot it can go to.
Anything that is not wearable gets the grid's own meaning for the click, the split prompt (issue #198), so a stack of arrows in the bag splits the same way it does in the bank.
SendQuickTransferRequest(int, int)
Sends the request that moves an item out of this panel and into QuickTransferTarget.
protected override void SendQuickTransferRequest(int fromSlot, int toSlot)
Parameters
fromSlotintSlot in this panel the item is leaving.
toSlotintSlot in the target container it is going to.
Remarks
The broadcast belongs to the DESTINATION container, not this one — moving into the bank is a bank swap whoever asked for it — so the panel losing the item is the one that has to name the other panel's request.
SendSplitRequest(int, int, InventoryType, uint)
Asks the server to split part of a stack into one of this panel's slots. Issue #198.
protected override void SendSplitRequest(int fromSlot, int toSlot, InventoryType fromInventory, uint amount)
Parameters
fromSlotintSlot holding the stack being split.
toSlotintSlot in this panel the split half is going to.
fromInventoryInventoryTypeContainer holding the stack being split.
amountuintHow much to take off it.
Remarks
As with SendSwapRequest(int, int, InventoryType), the request names its DESTINATION container, so the panel receiving the split half is the one that sends it.
SendSwapRequest(int, int, InventoryType)
Asks the server to move an item into one of this panel's slots.
protected override void SendSwapRequest(int fromSlot, int toSlot, InventoryType fromInventory)
Parameters
fromSlotintSlot the item is leaving.
toSlotintSlot in this panel it is going to.
fromInventoryInventoryTypeContainer the item is leaving.
Remarks
The only part of a drop that differs between panels: the request carries the same three fields either way, but the broadcast type names its destination container.