Skip to content

FieldEditorAttribute

namespace Griff.Scenes;
public abstract class FieldEditorAttribute : Attribute

Gives a property an editor of its own in the editor’s Inspector, in place of the plain box its type gets, for a value written in a little language of its own: dice, points, tile numbers, clips. Mark the property with one of these ([Dice], [Points], [TileNumbers]…) and the Inspector finds the editor made for it by its type, for Griff’s components and scripts’ alike; agents get the same through component_describe, which says what it takes (Describe), and are told what’s wrong with a value (Problem).

public virtual string FitsText { get; }

What it goes on, for the message when it’s put on something else: “a string”.

public abstract string Describe()

What the field takes and how the Inspector edits it, as component_describe says it after the field’s meaning, e.g. “Dice, like 2d6+3…”.

public virtual bool Fits(Type type)

True for the types of property it goes on: text, unless it says otherwise.

public virtual string? Problem(Component component, object? value)

What’s wrong with value on component, e.g. “\“2d\” isn’t dice”, or null when it reads. An empty value is never wrong.