PlayerListComponent
Classpublic sealed class PlayerListComponent : MenuComponentBase, IMenuComponent, IMenuRowSourceConstructors
Creates a player list.
public PlayerListComponent(string? id = null)- idstring?optionalA stable id, or null to generate one.
Properties
The button that clears the search. Only shown while a search is active.
public ButtonComponent ClearButton { get; }The target used when the search is empty.
public string DefaultTarget { get; set; }The colour of EmptyText, or null for the default colour.
public string? EmptyColor { get; set; }The text shown when nobody matches, or null for the translated default.
public string? EmptyText { get; set; }An extra filter applied after the search, or null to keep every match. Receives the viewer and the candidate.
public Func<IPlayer, IPlayer, bool>? Filter { get; set; }Turns a player into the text shown for them. An empty result shows the translated unknown-player text.
public Func<IPlayer, string> Formatter { get; set; }The hint shown while a player row holds the selection, or null for none.
public Func<IPlayer, string?>? ItemHint { get; set; }The style of a player row.
public MenuTextStyle ItemStyle { get; set; }The most players listed, or null for no limit.
public int? MaxResults { get; set; }How player names are compared.
public StringComparison NameComparison { get; set; }Turns a player into a full node, for lines with several colours. Takes over from Formatter when set.
public Func<IPlayer, MenuNode>? NodeFormatter { get; set; }Runs when the focus leaves a player row. Target is the player it left.
public Action<MenuPlayerContext>? OnPlayerDeselected { get; set; }Runs when a player activates a row.
public Action<MenuPlayerContext>? OnPlayerSelected { get; set; }How often the list is looked up again so joins and leaves show up.
public TimeSpan RefreshInterval { get; set; }Draws a player 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<MenuPlayerRowContext, MenuNode>? RowRenderer { get; set; }The search line. Its empty text and hint come from the translation file on every rebuild, so set them there.
public InputComponent SearchInput { get; }The search mode passed to StringComparison).
public TargetSearchMode SearchMode { get; set; }Whether ClearButton is shown while a search is active.
public bool ShowClearButton { get; set; }Whether the search line is shown. The filter can still be set with String).
public bool ShowSearch { get; set; }Orders the matches, or null to keep the order the search returns.
public Func<IEnumerable<IPlayer>, IEnumerable<IPlayer>>? Sorter { get; set; }Methods
Reads the search text of one session.
public string GetFilter(IMenuSession session)- sessionIMenuSession
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.
Looks the list up again for one session on its next draw.
public void Refresh(IMenuSession session)- sessionIMenuSession
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.
Sets the search text of one session.
public void SetFilter(IMenuSession session, string text)- sessionIMenuSession
- textstring
Raised when MenuRowContext) would return something different.
public event Action? RowsChanged