DialogPlayer
Inherits: Node
Description
Node that plays dialog trees from Sprouty Dialogs plugin. It reads a dialog file and processes a dialog tree by ID to play the dialog.
The dialog tree is composed of nodes that represent dialogues and actions. The player processes the nodes and plays the dialogues in DialogBox nodes.
Methods
| Return Type | Method |
|---|---|
| void | play_on_ready(play_on_ready: bool) |
| void | destroy_on_end(destroy: bool) |
| SproutyDialogsDialogueData | get_dialog_data() |
| String | get_start_id() |
| SproutyDialogsCharacterData | get_character_data(key_name: String) |
| DialogPortrait | get_current_portrait() |
| DialogBox | get_current_dialog_box() |
| void | set_dialog(data: SproutyDialogsDialogueData, start_id: String, portrait_parents: Dictionary = {}, dialog_box_parents: Dictionary = {}) |
| void | start() |
| void | pause() |
| void | resume() |
| void | stop() |
| bool | is_running() |
Signals
signal dialog_started()
Emitted when the dialog starts.
signal dialog_paused()
Emitted when the dialog is paused.
signal dialog_resumed()
Emitted when the dialog is resumed.
signal dialog_ended()
Emitted when the dialog is ended.
signal option_selected(option_index: int, option_dialog: Dictionary)
Emitted when a dialog option is selected.
signal signal_event(argument: String)
Emitted when a signal event is emitted.
signal dialog_player_stop()
Emitted when the dialog player stops.
Method Descriptions
func play_on_ready(play_on_ready: bool) -> void
Sets whether the dialog will be played when the player node is ready. If true, the dialog will start processing when the dialog player node is ready.
func destroy_on_end(destroy: bool) -> void
Sets whether the player will be destroyed when the dialogue ends. If true, the player will be freed from the scene tree when the dialog ends. If false, the player will remain in the scene tree to be reused later.
func get_dialog_data() -> SproutyDialogsDialogueData
Returns the DialogueData resource being processed.
func get_start_id() -> String
Returns the start ID of the dialog tree being processed.
func get_character_data(key_name: String) -> SproutyDialogsCharacterData
Returns the CharacterData for a given character key name.
func get_current_portrait() -> DialogPortrait
Returns the current portrait being displayed.
func get_current_dialog_box() -> DialogBox
Returns the current dialog box being displayed.
func set_dialog(data: SproutyDialogsDialogueData, start_id: String, portrait_parents: Dictionary = {}, dialog_box_parents: Dictionary = {}) -> void
Set the dialogue data and start ID to play a dialog tree. This method loads the dialog resources and prepares the player to process the dialog tree before calling the start() method.
func start() -> void
Start processing a dialog tree. Need to set the dialogue data and start ID before calling this method. The resources are loaded on the _ready() method.
func pause() -> void
Pause processing the dialog tree.
func resume() -> void
Resume processing the dialog tree.
func stop() -> void
Stop processing the dialog tree.
func is_running() -> bool
Check if the dialog is running.