Response¶
Choose Response Option Dialog¶
- class CommonChooseResponseOptionDialog(internal_dialog, include_previous_button=True, on_previous=<function CommonFunctionUtils.noop>, on_close=<function CommonFunctionUtils.noop>)¶
Bases:
CommonOptionDialogA dialog that displays a list of options.
Warning
Unless you know what you are doing, do not create an instance of this class directly!
- Parameters:
internal_dialog (CommonChooseResponseDialog) – The dialog this option dialog wraps.
include_previous_button (bool, optional) – If True, the Previous button will be appended to the end of the dialog. Default is True.
on_previous (Callable[[], None], optional) – A callback invoked upon the Previous response being chosen. Default is no operation.
on_close (Callable[[], None], optional) – A callback invoked upon the dialog closing.
- add_option(option)¶
Add an option to the dialog.
- Parameters:
option (CommonDialogResponseOption) – The option to add.
- build_dialog(*_, **__)¶
Build the dialog.
Note
Override this function to provide your own arguments.
- Returns:
The built dialog or None if a problem occurs.
- Return type:
Union[CommonUiResponseDialog, None]
- has_options()¶
Determine if the dialog has selectable options.
- Returns:
True, if the dialog has any options in it. False, if not.
- Return type:
bool
- property option_count¶
The number of options within the dialog.
- Returns:
The number of options within the dialog.
- Return type:
int
- show(*_, **__)¶
Show the dialog.
Note
Override this function to provide your own arguments.
Options¶
Response Option¶
- class CommonDialogResponseOption(value, context, on_chosen=<function CommonFunctionUtils.noop>)¶
Bases:
objectAn option the player can choose within a dialog.
- Parameters:
value (DialogOptionValueType) – The value of the option.
context (CommonDialogResponseOptionContext) – A context to customize the dialog option.
on_chosen (Callable[[DialogOptionValueType], Any], optional) – A callback invoked when the dialog option is chosen.
- as_response(option_id)¶
Convert the option into a response.
- Parameters:
option_id (int) – The index of the option.
- Returns:
The option as a Response
- Return type:
CommonUiDialogResponse
- choose()¶
Choose the option.
- Returns:
The result of choosing the option.
- Return type:
Any
- property context¶
The context of the option.
- property disabled_text¶
The text that displays on the option as a tooltip. If provided, the option will also be disabled.
- property on_chosen¶
The action to perform upon choosing this option.
- property subtext¶
The subtext that displays under the option.
- property text¶
The text of the dialog option.
- property value¶
The value of the option.
Response Option¶
- class CommonDialogResponseOptionContext(text_identifier, text_tokens=(), subtext_identifier=None, subtext_tokens=(), disabled_text_identifier=None, disabled_text_tokens=())¶
Bases:
objectA context used by
CommonDialogResponseOptionthat provides customization of options.- Parameters:
text_identifier (Union[int, str, LocalizedString, CommonStringId]) – The text of the option.
text_tokens (Iterator[Any], optional) – An iterator of Tokens that will be formatted into the text.
subtext_identifier (Union[int, str, LocalizedString, CommonStringId], optional) – The subtext of the option. Default is None.
subtext_tokens (Iterator[Any], optional) – An iterator of Tokens that will be formatted into the description.
disabled_text_identifier (Union[int, str, LocalizedString, CommonStringId], optional) – The text that displays on the option as a tooltip. Setting this value will also disable the option. Default is None.
disabled_text_tokens (Iterator[Any], optional) – An iterator of Tokens that will be formatted into the description.
- property disabled_text¶
The text that displays on the option as a tooltip. If provided, the option will also be disabled.
- property subtext¶
The subtext that displays under the option.
- property text¶
The text of the dialog option.