Skip to content

grid

A 2D grid of cells — board layouts, emoji palettes, image picks. Cells are always data-bound (via cells_key); set selectable: false to make it a display-only board.

C# factory

WidgetDefinitions.Grid(
id: "board",
rows: 3, cols: 3,
cellsKey: "cells",
positionX: 0.5f, positionY: 0.5f,
sizeW: 0.7f, sizeH: 0.7f
);
// Then push cells via screen data:
manager.UpdateScreenDataForAll("game", new
{
cells = new[]
{
new { id = "a1", label = "X", color = "#ef4444" },
new { id = "a2", label = "", disabled = true },
// ...
}
});

Wire format

FieldTypeRequiredNotes
idstringyes
type"grid"yes
position_x, position_y, size_w, size_hnumberno0..1 anchor + size.
rowsnumberyesRow count.
colsnumberyesColumn count.
cells_keystringyesReads screen.data[cells_key] for the cell array.
selectablebooleannoDefault true. Set false for a read-only board.

Cells shape: { id?: string, label: string, color?: string, disabled?: boolean }. If a cell has no id, the row/column index is used.

Events

Event typePayloadFires when
select{ cell_index: number, cell_id: string }Player taps a cell. cell_index is row-major (row * cols + col).

Example

manager.OnInput += (player, evt) =>
{
if (evt.WidgetId == "board" && evt.EventType == "select")
{
int idx = evt.GetInt("cell_index");
boardState.Mark(idx, player.Id);
}
};