Class UITKSlotPainter
Paints one occupied or empty slot from an item, and keeps that slot's tooltip in step.
public static class UITKSlotPainter
- Inheritance
-
UITKSlotPainter
- Inherited Members
Remarks
Static and element-addressed, rather than methods on the panel base, because a slot is painted by panels that deliberately do NOT derive from UITKSlotPanelBase. The inspect window draws a character's sockets and must not inherit the base's operation tracker, its slot locks or its container lookup — all three of those bottom out in the LOCAL player, and an inspect window's subject is somebody else. What the two genuinely share is how a socket LOOKS, and that is all this class is.
The resolution of the elements is still each panel's own business, which is the rule UITKSlotPanelBase already states: the item grids CREATE one element per container slot and the sheet QUERIES ten authored sockets. This takes those elements as arguments and never looks an element up by name.
The bodies here were lifted from UITKSlotPanelBase.SetSlotItem, ClearSlot and
RefreshSlotTooltip, which now call through. They stay in one place for the reason
issue #280 had to be fixed twice: the tooltip was opened from whatever item the pointer
found on the way in and nothing re-read it, so a swap under a stationary cursor left it
describing an item that was no longer there.
Fields
TOOLTIP_NAME
Name of the shared tooltip overlay, resolved by GameObject name through UIManager.
public const string TOOLTIP_NAME = "UITooltip"
Field Value
Remarks
The same string TOOLTIP_NAME holds; the base now reads it from here so there is one literal rather than two that agree by hand.
Methods
Clear(VisualElement, Label, string)
Paints an empty slot: icon cleared, stack badge hidden.
public static void Clear(VisualElement icon, Label amount, string hiddenClass)
Parameters
iconVisualElementThe slot's icon element.
amountLabelThe slot's stack-count label, or null.
hiddenClassstringThe USS class that hides the stack badge.
HideTooltip(VisualElement)
Hides the item tooltip when the pointer leaves a slot.
public static void HideTooltip(VisualElement owner)
Parameters
ownerVisualElementThe slot element the pointer left.
OpenTooltip(VisualElement, Item)
Opens the item tooltip for a slot the pointer has entered.
public static void OpenTooltip(VisualElement owner, Item item)
Parameters
ownerVisualElementThe slot element, so the tooltip can close itself if it is rebuilt.
itemItemWhat the slot holds.
Paint(VisualElement, Label, Item, string)
Paints an occupied slot: its icon, its stack badge, and its tooltip.
public static void Paint(VisualElement icon, Label amount, Item item, string hiddenClass)
Parameters
iconVisualElementThe slot's icon element.
amountLabelThe slot's stack-count label, or null.
itemItemThe item the slot now holds.
hiddenClassstringThe USS class that hides the stack badge.
RefreshTooltip(VisualElement, Item)
Re-points a slot's tooltip at what the slot now shows.
public static void RefreshTooltip(VisualElement owner, Item item)
Parameters
ownerVisualElementThe slot element.
itemItemWhat it now holds, or null when it now holds nothing.
Remarks
Called from both painters, so every path that changes a slot — a replicate arriving, a resync, a rebuild, a panel opening — keeps the tooltip honest without having to remember to. RefreshFor(VisualElement, ITooltip) does nothing unless the pointer is over THIS slot, which is what makes a per-slot call safe from a refresh loop.