Scripting API
Scripting API
UiTextHandler
Struct in Abyss.Core, from Abyss.Core.
What UiElement.SetText is given in place of a string: an interpolated string's pieces, written into a buffer it borrows as the compiler hands them over.
public ref struct UiTextHandlerRemarks
Written by the compiler, never by hand: element.SetText($"Score: {score}"). A value that formats itself into a span — every number, a DateTime, a Guid — is written straight into the buffer, in its format and the current culture, as a string's interpolation writes it; anything else is written as its ToString says.
Constructors
UiTextHandler
public UiTextHandler(int literalLength, int formattedCount)Borrows a buffer as big as the pieces are likely to need; called by the compiler.
Parameters
literalLength: How long the text written between the holes is.formattedCount: How many holes there are.
Methods
AppendLiteral
public void AppendLiteral(string value)Writes text between the holes.
Parameters
value
AppendFormatted
public void AppendFormatted(scoped ReadOnlySpan<char> value)Writes text.
Parameters
value
AppendFormatted
public void AppendFormatted(scoped ReadOnlySpan<char> value, int alignment = 0, string? format = null)Writes text, padded to alignment characters: on the left where it is positive.
Parameters
valuealignmentformat
AppendFormatted
public void AppendFormatted(string? value)Writes text.
Parameters
value
AppendFormatted
public void AppendFormatted(string? value, int alignment = 0, string? format = null)Writes text, padded to alignment characters: on the left where it is positive.
Parameters
valuealignmentformat
AppendFormatted<T>
public void AppendFormatted<T>(T value)Writes a value.
Type parameters
T
Parameters
value
AppendFormatted<T>
public void AppendFormatted<T>(T value, string? format)Writes a value in format: {seconds:F1}.
Type parameters
T
Parameters
valueformat
A number is written as the number it is, read where it lies, so it is never boxed — not even in code the JIT has not optimized yet, as it first compiles a method, or a Debug build, which it never optimizes. Anything else that formats itself into a span is asked as the runtime's own handler asks it, which boxes a value type only where the JIT has not optimized the call.
AppendFormatted<T>
public void AppendFormatted<T>(T value, int alignment)Writes a value padded to alignment characters: on the left where it is positive.
Type parameters
T
Parameters
valuealignment
AppendFormatted<T>
public void AppendFormatted<T>(T value, int alignment, string? format)Writes a value in format, padded to alignment characters: on the left where it is positive.
Type parameters
T
Parameters
valuealignmentformat
