githubEdit

MultiOptionPrompt

package com.skeletonarmy.marrow.prompts

Overview

MultiOptionPrompt<T> is a generic prompt used in pre-match configuration screens with Prompter. It allows drivers to select multiple options from a list using the gamepad. Each selected item is clearly marked, and the selection can be confirmed by navigating to the DONE entry and pressing the confirm button.


Usage

To create a new prompt, provide:

  1. A header for the prompt.

  2. A boolean indicating whether the user must select at least one option.

  3. A boolean indicating whether the selection order should be displayed.

  4. An integer specifying the maximum amount of options that can be selected.

  5. A list of selectable options.

Example:

new MultiOptionPrompt<>(
    "Select Starting Items",         // Header
    true,                            // Require at least one selection
    false,                           // Do not order the options
    2,                               // Max amount of selections
    Item.RED, Item.BLUE, Item.GREEN  // Options
);

This will display a scrollable list with checkboxes. Drivers can toggle each option by pressing the confirm button while the option is highlighted. The prompt returns a List<T> containing all selected options when DONE is confirmed.

circle-info

Can be used with any object type that has a meaningful toString() method, since it uses toString() to display the options.

Controls

  • D-PAD UP: Move selection up

  • D-PAD DOWN: Move selection down

  • A: Select

Telemetry Output Example

After pressing A on RED:

Attempting to confirm DONE without any selections (if requireSelection is true):

Last updated