Class PromptHelper

Helper to create input prompts for a player. The prompts will be created as promises that: Resolve when the player responds to the prompt Reject when the prompt is cancelled

Prompts will cancel if they are created in an anyExclusive call, and another prompt or delay created in the same call resolved first. Prompts will also cancel when created in an all call, and another promise in that call rejected.

Hierarchy

  • PromptHelper

Accessors

  • get activeCount(): number
  • Number of distinct active prompts for this player.

    Returns number

  • get messages(): readonly Message[]
  • Array of messages describing the active prompts for this player.

    Returns readonly Message[]

  • get respondedCount(): number
  • Total number of valid prompts that this player has responded to.

    Returns number

  • get totalCount(): number
  • Total number of distinct prompts for this player, both active and historical.

    Returns number

Methods

  • Cancels all active prompts for this player.

    Parameters

    • Optional reason: any

    Returns void

  • Creates a prompt that resolves when the player clicks on the given button. The button will be displayed in a message seen only by the prompted player. When resolved, the clicked button will be returned.

    Type Parameters

    Parameters

    Returns Promise<TButton>

    A promise that resolves to the clicked button.

  • Creates a prompt that resolves when the player clicks on the given button. The button will be displayed in a message seen only by the prompted player. When resolved, the clicked button will be returned.

    Parameters

    • label: string

      Text to be displayed on the button.

    • Optional options: IButtonClickOptions

      Optional options to configure the prompt.

    Returns Promise<string>

    A promise that resolves to label.

  • Creates a prompt that resolves when the player clicks on the given button. The button will be displayed in a message seen only by the prompted player. When resolved, the value specified in return will be returned.

    Type Parameters

    • TValue

    Parameters

    Returns Promise<TValue>

    A promise that resolves to return.

  • Creates a prompt that resolves when the player clicks on the given button. The button will be displayed in a message seen only by the prompted player. When resolved, the value specified in return will be returned.

    Type Parameters

    • TValue

    Parameters

    Returns Promise<TValue>

    A promise that resolves to return.

  • Creates a prompt that resolves when the player clicks on the given GameObject. An accompanying message must be provided in message that will be displayed to the prompted player. When resolved, the clicked object will be returned.

    Type Parameters

    Parameters

    Returns Promise<TObject>

    A promise that resolves to the clicked object.

  • Creates a prompt that resolves when the player clicks on the given GameObject. An accompanying message must be provided in message that will be displayed to the prompted player. When resolved, the value specified in return will be returned.

    Type Parameters

    • TValue

    Parameters

    Returns Promise<TValue>

    A promise that resolves to return.

  • Creates a prompt that resolves when any of the given GameObjects are clicked on. An accompanying message must be provided in message that will be displayed to the prompted player. When resolved, the clicked object will be returned.

    Type Parameters

    Parameters

    • objects: ArrayLike<TObject> | Iterable<TObject>

      The set of objects to be clicked.

    • options: IClickAnyOptions

      Options to configure the prompt, including the message text.

    Returns Promise<TObject>

    A promise that resolves to the clicked object.

  • Parameters

    Returns Promise<string>

Generated using TypeDoc