FormatAttribute
namespace Griff.Scenes;
public sealed class FormatAttribute : FieldEditorAttributeMarks a string property as text with holes the game fills in as it shows it, e.g. a counter’s “Score: {0}” or a save slot’s “{date} {time}”: the Inspector has a button for each hole, says what each is, and shows how it reads now. A hole can carry a number format after a colon (“{0:000}”). A hole it doesn’t have is flagged.
Properties
Section titled “Properties”public IReadOnlyList<ValueTuple<string, string>> Holes { get; }The holes, each with what it is: (“{0}”, “the count”).
Preview
Section titled “Preview”public string? Preview { get; init; }A method of the component taking the text (a string, or null) and giving how it reads with what the component holds now, e.g. a counter’s “Score: 12”; null when there’s none.
Replaced
Section titled “Replaced”public bool Replaced { get; init; }The holes are put in by replacing them (a choice’s {0}), rather than as a .NET format string, so a brace on its own is fine.
Methods
Section titled “Methods”Describe
Section titled “Describe”public override string Describe()Problem
Section titled “Problem”public override string? Problem(Component component, object? value)ReadsAs
Section titled “ReadsAs”public string? ReadsAs(Component component, string? format)How component’s text reads with format as its value now; null when it can’t say.