NumberFormatAttribute
namespace Griff.Scenes;
public sealed class NumberFormatAttribute : FieldEditorAttributeMarks a string property as how a number is written, a .NET number format: “0” whole, “0.00” two decimals, “0.##” up to two, “000” three digits. The Inspector offers the common ones and shows a number written that way.
Properties
Section titled “Properties”Common
Section titled “Common”public static IReadOnlyList<ValueTuple<string, string>> Common { get; }The formats offered, each with what it does.
Sample
Section titled “Sample”public string? Sample { get; init; }A number property of the component to show written in the format, e.g. a display’s “Value”; null for a sample.
Methods
Section titled “Methods”Describe
Section titled “Describe”public override string Describe()SampleOf
Section titled “SampleOf”public double SampleOf(Component component)The number to show component’s format with: its Sample, or 1234.5678 when that’s 0 or there’s none.
public static string Write(double number, string? format)number written in format, as the game writes it.