SproutyDialogsResourceManager
Inherits: Node
Description
This class is responsible for managing the resources used in the Sprouty Dialogs plugin when running a dialog.
It loads the character data, dialog boxes and portraits. It also provides methods to instantiate the dialog boxes and portraits during the dialogs.
This manager is used at runtime as an internal singleton to handle dialog resources. You shouldn't instantiate this class directly. Instead, access the singleton through the Sprouty Dialogs autoload.
Methods
| Return Type | Method |
|---|---|
| SproutyDialogsCharacterData | get_character_data(key_name: String) |
| void | release_resources(dialog_data: SproutyDialogsDialogueData, start_id: String) |
| void | load_resources(dialog_data: SproutyDialogsDialogueData, start_id: String) |
| DialogBox | instantiate_dialog_box(character_name: String, dialog_box_parent: Node) |
| DialogPortrait | instantiate_portrait(character_name: String, portrait_name: String, portrait_parent: Node, dialog_box: DialogBox = null) |
Method Descriptions
func get_character_data(key_name: String) -> SproutyDialogsCharacterData
Returns CharacterData for a given character key name. If the character is not loaded, returns null.
func release_resources(dialog_data: SproutyDialogsDialogueData, start_id: String) -> void
Releases the resources used by a DialogPlayer. This will remove the character data, dialog boxes, and portraits that are no longer needed by any DialogPlayer.
func load_resources(dialog_data: SproutyDialogsDialogueData, start_id: String) -> void
Load the resources needed to run a dialog. This will load the character data, dialog boxes, and portraits for the dialog. This only loads the resources to use them later, it does not instantiate them.
func instantiate_dialog_box(character_name: String, dialog_box_parent: Node) -> DialogBox
Instantiate a dialog box for a character in the scene. Instantiate from the loaded dialog boxes for the dialogs in the current scene. Cannot instantiate a dialog box that was not previously loaded.
func instantiate_portrait(character_name: String, portrait_name: String, portrait_parent: Node, dialog_box: DialogBox = null) -> DialogPortrait
Instantiate a character portrait. Instantiate from the loaded portraits for the dialogs in the current scene. Cannot instantiate a portrait that was not previously loaded.