Skip to content

RowsAttribute

namespace Griff.Scenes;
public abstract class RowsAttribute : FieldEditorAttribute

Marks a property as a list of rows, each of a few cells (a RowColumn each): items and how many, a tile and what it drops, a position’s name and where it is. The property is a string, its rows separated by commas (or what Separators says), or a list of strings, a row each. The Inspector lists the rows with a box, picker or number for each cell, to set, add, remove and reorder; agents set them the same way (each row’s cells by column name).

public abstract IReadOnlyList<RowColumn> Columns { get; }

The columns of each row, in order.

protected string ColumnsText { get; }

“Rows of an item and how many”: the columns, for Describe.

public abstract string Example { get; }

A row as it’s written, for what’s wrong with one, e.g. “Coin 3”.

public override string FitsText { get; }
protected virtual string Joiner { get; }

What a string’s rows are joined with.

public abstract string Noun { get; }

What a row is, “an item” or “a recipe”: for its Add button and for what’s wrong with one.

public bool One { get; init; }

It holds one row at most (a single difficulty): the Inspector shows its cells with nothing to add or remove.

protected virtual char[] Separators { get; }

What separates a string’s rows: commas and semicolons unless it says.

public static ValueTuple<string, string>? Colon(string row)

“name: text” split at its first colon, both trimmed; null without one, or with nothing before it.

public override bool Fits(Type type)
public static bool IsNumber(string? text)

True when text reads as a number.

public static bool IsWhole(string? text)

True when text reads as a whole number.

public virtual IReadOnlyList<string> MoreChoices(int column, Component component, IProjectNames? names)

What else column column’s cells offer on component, besides the project’s names and Choices: a character’s clips with the pictures, the difficulties the charts have.

public static ValueTuple<string, int> NameCount(string text)

“Coin 3” read as a name and how many after it (1 when it doesn’t say); “Coin” is (“Coin”, 1).

public IEnumerable<ValueTuple<NamesAttribute, string>> Named(object? value)

Each name value’s cells give of what Names says (an amounts cell’s each), with what it names: the names a column that defines them adds to the project’s (an item given, a resource had).

public virtual IReadOnlyList<string> NewRow()

A new row’s cells, as Add puts on the end.

public virtual string? Note(Component component, IReadOnlyList<string> cells, IProjectNames? names)

A word under row cells about what it does now, e.g. “Chart: the First Light table” or “No table is called First Light”; null for none.

public static string Number(double value)

A number as a cell holds it: invariant, on hundredths.

public override string? Problem(Component component, object? value)
public abstract IReadOnlyList<string>? Read(string row)

A row’s cells, a string each, as many as Columns; null when it doesn’t read.

public IReadOnlyList<string> Rows(object? value)

The rows value holds, as written, blank ones left out.

public object? Store(IEnumerable<string> rows, Type type)

The value holding rows, for a property of type: joined, or a list.

public abstract string Write(IReadOnlyList<string> cells)

A row written from its cells, as the field holds it.