ControlsList
namespace Griff.Scenes;
public sealed class ControlsList : Component, IDrawableA controls screen with no hand-placed buttons: while the game runs it makes a row for each input action, its name and a Rebind button showing its keys (“Drop Tool” and “Esc / Right Click”), that the player clicks and then presses a new key for. The rows follow the device being played with and the player’s rebinding, and are made again when the actions change. Put it on an entity with a Layout (in an options Panel), which lines the rows up and scrolls them; add a Reset Controls button beside it to put everything back.
Its children that hold a Rebind button are its rows: it takes them away and makes them again when what it lists changes, and leaves its other children (a heading) alone. Each plain row is an entity named after its action with a Text for the name and a Button for each of Slots; a Template gives rows of your own. The Scene view shows sample rows where they’ll go.
This is a component: its saved properties are on its component page.
Properties
Section titled “Properties”Actions
Section titled “Actions”public string? Actions { get; set; }The actions to list, in this order, separated by commas, e.g. “Jump, Dash, Pause”; * stands for any letters and ? for one, so “Pan*” lists Pan Up, Pan Down, Pan Left and Pan Right. Empty lists those Show picks.
ButtonColor
Section titled “ButtonColor”public Color ButtonColor { get; set; }The color of the plain rows’ Rebind buttons.
ButtonWidth
Section titled “ButtonWidth”public float ButtonWidth { get; set; }How wide each plain row’s Rebind buttons are, in world units.
public Color Color { get; set; }The color of the plain rows’ words.
public string? Font { get; set; }A font for the plain rows’ words, as a Text’s Font. Empty uses the built-in font.
public string? Hide { get; set; }Actions to leave out, separated by commas, with * and ? as in Actions, e.g. “Debug*, Pause” for the debug keys and the pause key.
Labels
Section titled “Labels”public string? Labels { get; set; }The names to show for actions, “Action = Name” separated by commas, e.g. “DropTool = Put Down, PanUp = Look Up”. Any other action shows its own name in words: “DropTool” as “Drop Tool”.
Listed
Section titled “Listed”public IReadOnlyList<string> Listed { get; }The actions it lists now, in order. Kept up to date by the game.
RowHeight
Section titled “RowHeight”public float RowHeight { get; set; }How tall each plain row is, in world units; it’s as wide as the Layout has room for.
public IReadOnlyList<Entity> Rows { get; }The rows it made, one for each of Listed, in the same order. Kept up to date by the game.
public ControlsShown Show { get; set; }While Actions is empty: every action, or only the game’s own (not Griff’s built-in ones).
public int Slots { get; set; }How many Rebind buttons a row has. 1 shows every key of the action on the device in use (“Esc / Right Click”) on one button, which replaces the first; 2 or more give a button for each binding in turn (a primary and a secondary key), each replacing its own (see BindingSlot).
Template
Section titled “Template”public string? Template { get; set; }An entity to copy for each row instead of the plain ones, by name, e.g. “Controls Row”: a disabled one in the scene styled as you like. In each copy, “{name}” in a Text becomes the action’s name and “{action}” its keys (“{action:all}”, “{action:1}” and so on, as in any Text), and a Rebind button with no Input Action rebinds the row’s action.
TextSize
Section titled “TextSize”public float TextSize { get; set; }How tall the plain rows’ words are, in world units.
Methods
Section titled “Methods”LabelOf
Section titled “LabelOf”public string LabelOf(string action)The name a row shows for action: its Labels entry, or its name in words.
public List<string> Pick(IEnumerable<string> actions)The actions it lists out of actions (all there are, in order), as Actions, Show and Hide say.