Skip to content

LetterCountsAttribute

namespace Griff.Scenes;
public sealed class LetterCountsAttribute : FieldEditorAttribute

Marks a string property as letters, each from a set and each as many times as it comes: a falling-block board’s pieces, “IJLOSTZ” (each once) or “IIO” (twice as many I’s). The Inspector has a count for each letter, with its picture.

public string? Cells { get; init; }

A static method of the component taking a letter (a char) and giving the cells of its picture, (x, y) pairs, y up: a piece’s shape. Null for none.

public string Letters { get; }

The letters there are, in order.

public string Noun { get; init; }

What they are, e.g. “pieces”, for the descriptions.

public IReadOnlyList<ValueTuple<int, int>> CellsOf(Component component, char letter)

The cells of letter’s picture on component’s type, or none.

public override string Describe()
public override string? Problem(Component component, object? value)
public IReadOnlyList<int> Read(string? text)

How many times each letter comes in text.

public string Write(IReadOnlyList<int> counts)

The text for counts, a count for each letter in order: “IJLOSTZ”, “IIO”.