Table of Contents

Class CharacterSheetView

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Binds UICharacterSheet.uxml to one subject: the ten sockets, the character preview and the HP / MP / Stamina chips.

public sealed class CharacterSheetView
Inheritance
CharacterSheetView
Inherited Members

Remarks

This is the half of the character sheet that is the same whoever is looking at it. The player's own equipment panel and the inspect window mount the same markup and show the same three regions; what differs is only what they are allowed to reveal, which is CharacterSheetOptions, and what they do with a click, which is not this class's business at all.

Deliberately not a UITKSlotPanelBase. That class is not a set of drawing helpers, it is an operation tracker: its OwnContainer, IsSlotBlocked and ApplySlotLockVisual all bottom out in Character — which UIManager fills with the LOCAL player for every UITKCharacterControl it enrols, with no way to opt out. An inspect window holding a subject who is somebody else, deriving from that base, would silently inherit the local player's containers and in-flight equip state. So the sharing here is composition, the way UITKItemIcon and EquipmentPreviewRenderer are shared, and the slot PAINTING is UITKSlotPainter's.

It resolves the sockets and hands them out. SlotElementNames is the contract with ItemSlot — one authored element per enum value, in enum order — and it lives here, once, because both panels need it. Each panel still does its own marking and wiring on the elements it takes: the equipment panel registers the interactive handlers, the inspect window registers none. That is the rule UITKSlotPanelBase already states about slot creation, kept intact.

Constructors

CharacterSheetView(VisualElement, CharacterSheetOptions)

Resolves the sheet's elements and hides the regions this viewer may not see.

public CharacterSheetView(VisualElement root, CharacterSheetOptions options)

Parameters

root VisualElement

The mounted sheet's root element.

options CharacterSheetOptions

What this viewer is allowed to see.

Fields

SlotElementNames

UXML element name for every ItemSlot, indexed by its enum value.

public static readonly string[] SlotElementNames

Field Value

string[]

Remarks

THIS ARRAY IS A CONTRACT, NOT A CONVENIENCE. EquipmentController sizes its container from Enum.GetNames(typeof(ItemSlot)).Length, so slot i of the container is (ItemSlot)i and must be drawn by SlotElementNames[i]. Every enum value needs an entry, in order, and every entry needs an element of that name in UICharacterSheet.uxml.

The comment that used to sit on a copy of this array claimed it listed "only slots that exist in both the enum and the UXML", which was untrue in both directions: it named slot-accessory, which the UXML did not define, while the UXML defined slot-neck and slot-ring, which are not ItemSlot values and which this array did not name. The result was an Accessory slot that could never render — Q returned null and the per-slot guard quietly skipped it — and two dead elements the player could click to no effect. Both halves are fixed; the markup now declares exactly these ten names, and there is one array rather than one per panel.

TITLE_NAME

Name of the label showing the subject's name.

public const string TITLE_NAME = "header-title"

Field Value

string

Properties

PanelRoot

The window itself — the authored panel-root, not the document's container.

public VisualElement PanelRoot { get; }

Property Value

VisualElement

Remarks

A UIDocument hands out a container element that the UXML tree is cloned INTO, so the tree's own root is a CHILD of the element a panel is tempted to treat as "the root". A class added to the container is therefore matched by nothing in the stylesheet, and its position is not the position of anything on screen.

Everything that places this window belongs on this element, and so does anything that considers where the window is: UITKControl drags the nearest fish-panel ancestor of the header, which is exactly this one. A placement override written to the container would not move the box the player drags, and the first drag would then have to fight it.

ShowAttributes

Whether this viewer may see the attribute list.

public bool ShowAttributes { get; }

Property Value

bool

SlotRoots

The ten sockets, indexed by ItemSlot, null where the markup lacks one.

public IReadOnlyList<VisualElement> SlotRoots { get; }

Property Value

IReadOnlyList<VisualElement>

Subject

The subject this sheet is showing, or null.

public IPlayerCharacter Subject { get; }

Property Value

IPlayerCharacter

TitleLabel

The label a panel may set to name the subject.

public Label TitleLabel { get; }

Property Value

Label

Remarks

Exposed rather than set here, because the two windows disagree about it: the player's own sheet always says EQUIPMENT, and an inspect window names the character it is showing.

Methods

ClearSockets()

Paints every socket empty.

public void ClearSockets()

Dispose()

Releases everything this sheet owns for the rest of the session.

public void Dispose()

Remarks

Disposes rather than dropping the reference: the camera belongs to the character and would otherwise stay enabled — rendering the character into a texture nobody draws, every frame, for the rest of the session.

EnableSocketHover()

Wires the read-only item tooltip onto the sockets.

public void EnableSocketHover()

Remarks

Opt-in, and it has to be. The player's own sheet gets this behaviour from OnSlotPointerEnter(int, VisualElement), which looks the item up in the container that panel is bound to; a viewer that may not act on a socket has no such container and asks the sheet for the behaviour instead. Wiring both would open the same tooltip twice.

A tooltip is not an interaction. Inspecting a character is how a player judges their gear, and an item's name and stats live in its tooltip — reading one changes nothing about the character being read.

InvalidatePreviewFraming()

Marks the preview framing as stale.

public void InvalidatePreviewFraming()

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.

PaintSockets()

Paints the ten sockets read-only from this sheet's subject.

public void PaintSockets()

Remarks

Every socket is painted, empty ones included, so a sheet pointed at a second character cannot leave the first one's gear on screen. A sheet with no subject paints every socket empty for the same reason.

The painting itself is UITKSlotPainter's, and it is the same call the player's own sheet makes. What this method deliberately never does is register a handler on what it paints: the equipment panel's sockets get their press, drag and drop behaviour from UITKSlotPanelBase, and a second set registered here would double it.

Refresh()

Re-reads everything the sheet shows from its subject, without rebuilding the tree.

public void Refresh()

Remarks

The preview is rebuilt on every open, not just the first: the camera and texture belong to the character and are handed back when the sheet closes, so the opening after that starts from nothing.

RefreshPreview()

Adopts the subject's preview camera and renders it into the viewport.

public void RefreshPreview()

Remarks

Safe to call every frame: it returns immediately until the UI layout engine has measured the viewport, and once the preview is framed it is one small orthographic render into a texture already sized for the element.

The camera is taken from the character rather than injected by whoever opened the sheet. It used to be handed over by the equipment hotkey, which meant the preview depended on how the panel was opened and not on what it was showing.

For an inspected character this photographs their race model and nothing else: no equipment geometry is ever built for a character you do not own. See the panel's remarks.

ReleasePreview()

Hands the preview camera and texture back.

public void ReleasePreview()

Remarks

Called when the sheet goes off screen, when its subject changes and when it is destroyed. 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.

SetSubject(IPlayerCharacter)

Points the sheet at a character, replacing whatever it was showing.

public void SetSubject(IPlayerCharacter subject)

Parameters

subject IPlayerCharacter

The character to show, or null to show nothing.

Remarks

The outgoing character's subscriptions and preview camera are released BEFORE the reference moves. Doing it the other way round is the bug this class inherits from the panel it came from: detaching afterwards looked up the attributes of the INCOMING character and left the outgoing one wired to this sheet forever, while its camera stayed enabled and rendered into a texture nothing was drawing.