PagedCollectionComponent`1
Classpublic sealed class PagedCollectionComponent<TItem> : MenuComponentBase, IMenuComponent, IMenuRowSourceConstructors
Creates a collection.
public PagedCollectionComponent(Func<Task<IReadOnlyList<TItem>>> loader, string? id = null)- loaderFunc<Task<IReadOnlyList<TItem>>>Produces the items. Runs on the collection loader thread.
- idstring?optionalA stable id, or null to generate one.
Properties
The colour of EmptyText, or null for the default colour.
public string? EmptyColor { get; set; }The text shown when the loader returns no items.
public string? EmptyText { get; set; }The colour of FailedText, or null for the default colour.
public string? FailedColor { get; set; }The text shown when the loader throws.
public string? FailedText { get; set; }Turns an item into the text shown for it.
public Func<TItem, string> Formatter { get; set; }The hint shown while an item row holds the selection, or null for none.
public Func<TItem, string?>? ItemHint { get; set; }The style of an item row.
public MenuTextStyle ItemStyle { get; set; }The colour of LoadingText, or null for the default colour.
public string? LoadingColor { get; set; }The text shown while the loader is running.
public string? LoadingText { get; set; }Turns an item into a full node, for lines with several colours. Takes over from Formatter when set.
public Func<TItem, MenuNode>? NodeFormatter { get; set; }Runs when a player activates an item row.
public Action<MenuCollectionItemContext<TItem>>? OnItemSelected { get; set; }Draws an item row with full control over its layout, including its index and focus. Takes over from NodeFormatter and Formatter when set. The busy placeholder still shows while a row waits on an action.
public Func<MenuCollectionRowContext<TItem>, MenuNode>? RowRenderer { get; set; }Whether the exception message is appended to FailedText.
public bool ShowFailureMessage { get; set; }Methods
The body entries this component stands for right now.
public IReadOnlyList<IMenuComponent> GetRows(IMenuSession session, MenuRowContext context)- sessionIMenuSessionThe session the rows are for.
- contextMenuRowContextServices the rows need.
Runs the loader again. Open menus update when it finishes. Does nothing before the first layout.
public void Reload()Produces this component's renderer-agnostic output.
public override MenuNode Render(IMenuComponentRenderContext context)- contextIMenuComponentRenderContextThe player and focus state to draw for.
Never drawn: the menu replaces this component with MenuRowContext) when it lays out the body.
Raised when MenuRowContext) would return something different.
public event Action? RowsChanged