Skip to content

NumberFormatAttribute

namespace Griff.Scenes;
public sealed class NumberFormatAttribute : FieldEditorAttribute

Marks 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.

public static IReadOnlyList<ValueTuple<string, string>> Common { get; }

The formats offered, each with what it does.

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.

public override string Describe()
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.