Skip to content

ComponentOutput

namespace Griff.Scenes;
public sealed class ComponentOutput

One thing a component knows that anything can read (see OutputAttribute): its name, what it gives, and the read itself, which allocates nothing.

public Type ComponentType { get; }

The component type it belongs to.

public string DisplayName { get; }

What it’s called with spaces between the words, e.g. “Moves Left”.

public string? Example { get; }

For one read by a name, a name it’s read by, e.g. “Gold” (see Example).

public IReadOnlyList<string> FormerNames { get; }

Names it had before (FormerNameAttribute): what still names it.

public bool IsKeyed { get; }

True for one read by a name: “Amount:Gold”.

public bool IsNumber { get; }

True for one that gives a number, a whole number or true or false (1 or 0): what a counter, a bar and a wire can read.

public string? KeyName { get; }

For one read by a name, what the name is, from the method’s parameter, e.g. “kind”; null for one that isn’t.

public MemberInfo Member { get; }

The property (or, for one read by a name, the method) it reads.

public string Name { get; }

What it’s called, without spaces, e.g. “MovesLeft”.

public string? OutOfName { get; }

The property it’s out of (see OutOf), e.g. “TargetScore”; null for none.

public string QualifiedName { get; }

“MatchBoard.Score”: the component’s name and the output’s, which names it even on an entity where two components have one called the same.

public string Reference { get; }

How it’s written where it’s read: its name, or for one read by a name, its name and an example, e.g. “Amount:Gold”.

public string ValueKind { get; }

“a number”, “a whole number”, “true or false” or “a name”.

public Type ValueType { get; }

What it gives: Single, Int32, Boolean or String.

public bool IsCalled(ReadOnlySpan<char> name)

True if name names it: its name or a former one (FormerNames), whatever the capitals and spaces (“moves left” is MovesLeft), or with its component’s in front (“MatchBoard.Score”). The name it’s read by (after a colon) isn’t part of it.

public float ReadNumber(Component component, string? key = null)

What it gives on component as a number: true is 1 and false 0, and a name 0. key is the name for one read by a name.

public float ReadOutOf(Component component, string? key = null)

What it’s out of on component (see OutOf); 0 for nothing.

public string? ReadText(Component component, string? key = null)

What it gives on component for one that gives a name; null for one that gives a number.

public override string ToString()