Class TooltipContent
A tooltip as structured data: an icon, a title, and typed rows.
public sealed class TooltipContent
- Inheritance
-
TooltipContent
- Inherited Members
Remarks
Tooltips used to exist only as one rich-text string, assembled by every template type in its
own BuildTooltip and handed to a single Label. That made the content
impossible to work with anywhere else: the crafting panel could not lay stats out in
columns, could not show what an added effect changed, and could not mark a requirement the
character fails, because by the time it had the tooltip everything was already
<color> tags in a sentence. Two systems produced tooltips this way — items and
abilities — and neither could reuse a line of the other's.
The rows carry meaning instead, and every producer in the game builds one of these. ToRichText() flattens them for anything that genuinely needs a string, and the client renders them as real elements.
Fields
Accent
An accent colour for the whole tooltip — an item's rarity, an ability's school.
public Color? Accent
Field Value
- Color?
Icon
The subject's icon, when it has one.
public Sprite Icon
Field Value
- Sprite
Rows
Rows in insertion order; Sort() puts them in display order.
public readonly List<TooltipRow> Rows
Field Value
Title
The subject's name, mirrored from the title row for convenience.
public string Title
Field Value
Properties
IsEmpty
True when nothing has been added.
public bool IsEmpty { get; }
Property Value
Methods
Add(TooltipRow)
Adds a row.
public TooltipContent Add(TooltipRow row)
Parameters
rowTooltipRow
Returns
AddBody(string, int, TooltipTone, TooltipStyle)
Adds a paragraph of prose.
public TooltipContent AddBody(string text, int priority = 10, TooltipTone tone = TooltipTone.Neutral, TooltipStyle style = TooltipStyle.None)
Parameters
textstringpriorityinttoneTooltipTonestyleTooltipStyle
Returns
AddEffect(string, int, TooltipTone)
Adds something the subject does.
public TooltipContent AddEffect(string text, int priority = 70, TooltipTone tone = TooltipTone.Neutral)
Parameters
textstringpriorityinttoneTooltipTone
Returns
AddHeader(string, int)
Adds a group header.
public TooltipContent AddHeader(string text, int priority)
Parameters
Returns
AddHint(string, int)
Adds guidance addressed to the player.
public TooltipContent AddHint(string text, int priority = 900)
Parameters
Returns
AddRequirement(string, int, TooltipTone)
Adds a requirement, toned by whether the character meets it.
public TooltipContent AddRequirement(string text, int priority = 60, TooltipTone tone = TooltipTone.Neutral)
Parameters
textstringpriorityinttoneTooltipTone
Returns
AddSeparator(int)
Adds a horizontal rule.
public TooltipContent AddSeparator(int priority)
Parameters
priorityint
Returns
AddStat(string, string, int, string, TooltipTone, TooltipTone, Color?)
Adds a two-column stat row, optionally carrying what it changed by.
public TooltipContent AddStat(string label, string value, int priority = 30, string delta = null, TooltipTone deltaTone = TooltipTone.Neutral, TooltipTone tone = TooltipTone.Neutral, Color? color = null)
Parameters
labelstringvaluestringpriorityintdeltastringdeltaToneTooltipTonetoneTooltipTonecolorColor?
Returns
AddSubtitle(string, int, TooltipTone)
Adds the short qualifier under the title.
public TooltipContent AddSubtitle(string text, int priority = 5, TooltipTone tone = TooltipTone.Muted)
Parameters
textstringpriorityinttoneTooltipTone
Returns
AddTitle(string, int, Color?)
Adds the subject's name.
public TooltipContent AddTitle(string text, int priority = 0, Color? color = null)
Parameters
Returns
Append(TooltipContent)
Appends every row of other, keeping its priorities.
public TooltipContent Append(TooltipContent other)
Parameters
otherTooltipContent
Returns
Remarks
How a composite subject is assembled — an item and its generated attributes, an ability and each event crafted onto it. The rows interleave by priority afterwards, so a component's stats land in the stats block rather than after everything the parent wrote.
Clear()
Drops every row.
public void Clear()
Sort()
Sorts rows by priority, keeping authored order within a priority.
public void Sort()
ToRichText()
Flattens the rows to a rich-text string, for the places that genuinely need one.
public string ToRichText()
Returns
Remarks
The structured renderer is the real output path. This exists for logs, for tests, and for any caller that has only a plain label to write into.