forked from dialogic-godot/dialogic
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Allow custom text nodes via
text_node
property.
- Loading branch information
Showing
2 changed files
with
22 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,33 @@ | ||
## Dialogic Node that displays choices. | ||
|
||
class_name DialogicNode_ChoiceButton | ||
extends Button | ||
|
||
## Dialogic Node that displays choices. | ||
|
||
|
||
## Used to identify what choices to put on. If you leave it at -1, choices will be distributed automatically. | ||
@export var choice_index:int = -1 | ||
@export var choice_index: int = -1 | ||
|
||
## Can be set to play this sound when pressed. Requires a sibling DialogicNode_ButtonSound node. | ||
@export var sound_pressed: AudioStream | ||
## Can be set to play this sound when hovered. Requires a sibling DialogicNode_ButtonSound node. | ||
@export var sound_hover: AudioStream | ||
## Can be set to play this sound when focused. Requires a sibling DialogicNode_ButtonSound node. | ||
@export var sound_focus: AudioStream | ||
## If set, the text will be set on this node's `text` property instead. | ||
@export var text_node: Node | ||
|
||
|
||
## Called when the text changes. | ||
func _set_text_changed(new_text: String) -> void: | ||
if text_node == null: | ||
text = new_text | ||
|
||
else: | ||
text_node.text = new_text | ||
|
||
|
||
func _ready(): | ||
func _ready() -> void: | ||
add_to_group('dialogic_choice_button') | ||
shortcut_in_tooltip = false | ||
hide() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters