1 class_name DialogicNode_ChoiceButton
3 ## The button allows the player to make a choice in the Dialogic system.
5 ## This class is used in the Choice Layer. [br]
6 ## You may change the [member text_node] to any [class Node] that has a
7 ## `text` property. [br]
8 ## If you don't set the [member text_node], the text will be set on this
11 ## Using a different node may allow using rich text effects; they are
12 ## not supported on buttons at this point.
15 ## Used to identify what choices to put on. If you leave it at -1, choices will be distributed automatically.
16 @export var choice_index: int = -1
18 ## Can be set to play this sound when pressed. Requires a sibling DialogicNode_ButtonSound node.
19 @export var sound_pressed: AudioStream
20 ## Can be set to play this sound when hovered. Requires a sibling DialogicNode_ButtonSound node.
21 @export var sound_hover: AudioStream
22 ## Can be set to play this sound when focused. Requires a sibling DialogicNode_ButtonSound node.
23 @export var sound_focus: AudioStream
24 ## If set, the text will be set on this node's `text` property instead.
25 @export var text_node: Node
28 func _ready() -> void:
29 add_to_group('dialogic_choice_button')
30 shortcut_in_tooltip = false
34 func _load_info(choice_info: Dictionary) -> void:
35 set_choice_text(choice_info.text)
36 visible = choice_info.visible
37 disabled = choice_info.disabled
40 ## Called when the text changes.
41 func set_choice_text(new_text: String) -> void:
43 text_node.text = new_text