Interface: NarrationChoicesInterface
Defined in: src/narration/interfaces/NarrationChoicesInterface.ts:5
Accessors
list
Get Signature
> get list(): StoredIndexedChoiceInterface[] | undefined
Defined in: src/narration/interfaces/NarrationChoicesInterface.ts:9
The choices to be shown in the game.
Returns
StoredIndexedChoiceInterface[] | undefined
Set Signature
> set list(data): void
Defined in: src/narration/interfaces/NarrationChoicesInterface.ts:14
The choices to be shown in the game.
Throws
when a choice contains functions or class instances that cannot be serialized to JSON.
Parameters
data
StoredChoiceInterface[] | undefined
Returns
void
Methods
select()
> select<T>(item, props): Promise<StepLabelResultType>
Defined in: src/narration/interfaces/NarrationChoicesInterface.ts:36
Select a choice from the choice menu, and close the choice menu.
Type Parameters
T
T extends object
Parameters
item
The choice item selected by the player.
props
The props to pass to the label.
Returns
Promise<StepLabelResultType>
StepLabelResultType or undefined.
Throws
when the choice type is not "call", "jump", or "close".
Example
narration.choices.select(item, {
navigate: navigate,
// your props
...item.props
})
.then(() => {
// your code
})
.catch((e) => {
// your code
})