Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

DialogicNode_ChoiceButton

This contains the source code documentation of the class DialogicNode_ChoiceButton.

DialogicNode_ChoiceButton

Inherits: Button

This button allows the player to make a choice in the Dialogic system.

Description

When a choice is reached Dialogic will automatically show ChoiceButtons and call their _load_info()[/code] method which will display the choices. You will need to ensure that enough choice buttons are available in the tree to display all choices.

You can extend this node and implement some custom logic by overwriting the _load_info(info:Dictionary)[/code] method.

If you need RichText support, consider adding a RichTextLabel child and setting it as the text_node.

DialogicChoiceButtons will grab the focus when hovered to avoid a confusing focus style being present for players who use the mouse. To avoid the opposite situation, when the focus is changed by the player and a different button is still hovered the mouse pointer will be moved to the now focused button as well.

Properties


Methods

ReturnsMethod
voidset_choice_text ( new_text: String )

Signals

signal choice_selected ( )

Emitted when the choice is selected. Unless overridden, this is when the button or its shortcut is pressed.


Property Descriptions

var choice_index = -1

Used to identify what choices to put on. If you leave it at -1, choices will be distributed automatically.


var sound_pressed

Can be set to play this sound when pressed. Requires a sibling DialogicNode_ButtonSound node.


var sound_hover

Can be set to play this sound when hovered. Requires a sibling DialogicNode_ButtonSound node.


var sound_focus

Can be set to play this sound when focused. Requires a sibling DialogicNode_ButtonSound node.


var text_node

If set, the text will be set on this node's text property instead. This can be used to have a custom text rendering child, like a RichTextLabel.


Method Descriptions

func set_choice_text ( new_text: String ) ⇒ void

Called when the text changes.