Table of Contents

Class UITKRichText

Namespace
FishMMO.Client
Assembly
FishMMO.Client.dll

Translates the TextMeshPro rich-text markup produced across FishMMO-Shared into markup a UI Toolkit Label renders correctly.

public static class UITKRichText
Inheritance
UITKRichText
Inherited Members

Remarks

Tooltips, chat lines and world labels are all built by shared code — TooltipBuilder, RichText, ChatHelper — that predates UI Toolkit and emits TextMeshPro tags. Almost all of them are common to both parsers, but one is not: <size=120%>. TextMeshPro reads a percentage as a multiple of the current size; UI Toolkit's parser accepts absolute lengths and signed offsets only, and a percentage makes it drop the tag — so every item name, ability name and attribute header silently loses its emphasis.

Rewriting at display time rather than at the source keeps a single markup dialect in the shared assembly, which the server also compiles, and leaves the tooltip text usable by anything else that wants it.

Sizes are resolved against a caller-supplied base rather than tracked through nesting. The generators never nest <size> — each builder line opens and closes its own — so a single base is exact for the markup that actually exists, and predictable for the markup that does not.

Fields

DefaultBaseFontSize

Font size assumed when a caller does not supply one, in panel points.

public const float DefaultBaseFontSize = 12

Field Value

float

Remarks

Matches .fish-tooltip__body in FishMMO-Theme.uss.

Methods

Strip(string)

Removes every rich-text tag, leaving the visible characters.

public static string Strip(string text)

Parameters

text string

Source markup, possibly null or empty.

Returns

string

The text with all markup removed.

Remarks

For places that need the plain string — measuring, sorting, logging — where leaving markup in would compare or size against characters nobody sees.

ToUITK(string, float)

Converts TextMeshPro markup to UI Toolkit markup.

public static string ToUITK(string text, float baseFontSize = 12)

Parameters

text string

Source markup, possibly null or empty.

baseFontSize float

Font size percentages resolve against, in panel points.

Returns

string

Markup safe to assign to a UI Toolkit Label.text.