From a3ea87aeac7de48bbbe38c1fe621307710ee43bd Mon Sep 17 00:00:00 2001 From: nlupugla Date: Sun, 31 Dec 2023 17:27:54 -0500 Subject: [PATCH] Added types to the textbubble and speaker_textbubble examples --- .../Modules/History/subsystem_history.gd | 16 ++++++------- addons/dialogic/Other/DialogicUtil.gd | 24 ++++--------------- .../Resources/dialogic_layout_base.gd | 2 +- addons/dialogic/Resources/dialogic_style.gd | 3 --- 4 files changed, 13 insertions(+), 32 deletions(-) diff --git a/addons/dialogic/Modules/History/subsystem_history.gd b/addons/dialogic/Modules/History/subsystem_history.gd index b6bbd9305..b0eb3e990 100644 --- a/addons/dialogic/Modules/History/subsystem_history.gd +++ b/addons/dialogic/Modules/History/subsystem_history.gd @@ -6,20 +6,20 @@ class_name DialogicSubsystemHistory ## Simple history that stores limited information ## Used for the history display -var simple_history_enabled : bool = true +var simple_history_enabled := true var simple_history_content : Array[Dictionary] = [] signal simple_history_changed ## Full event history (can be used for undo) -var full_event_history_enabled : bool = false -var full_event_history_content : Array = [] +var full_event_history_enabled := false +var full_event_history_content := [] signal full_event_history_changed ## Read text history ## Stores which text events and choices have already been visited -var already_read_history_enabled : bool = false -var already_read_history_content : Dictionary = {} -var _was_last_event_already_read : bool = false +var already_read_history_enabled := false +var already_read_history_content := {} +var _was_last_event_already_read := false signal already_read_event_reached signal not_read_event_reached @@ -47,7 +47,7 @@ func _ready() -> void: ## SIMPLE HISTORY #################################################################################################### -func store_simple_history_entry(text:String, event_type:String, extra_info : Dictionary = {}) -> void: +func store_simple_history_entry(text:String, event_type:String, extra_info := {}) -> void: if !simple_history_enabled: return extra_info['text'] = text extra_info['event_type'] = event_type @@ -80,7 +80,7 @@ func store_full_event(event:DialogicEvent) -> void: func _current_event_key() -> String: var resource_path : String = dialogic.current_timeline.resource_path var event_idx : String = str(dialogic.current_event_idx) - var event_key : String = resource_path+event_idx + var event_key : String = resource_path + event_idx return event_key diff --git a/addons/dialogic/Other/DialogicUtil.gd b/addons/dialogic/Other/DialogicUtil.gd index 7722566ea..e993e576f 100644 --- a/addons/dialogic/Other/DialogicUtil.gd +++ b/addons/dialogic/Other/DialogicUtil.gd @@ -13,9 +13,9 @@ static func get_editor_scale() -> float: ## Although this does in fact always return a EditorPlugin node, ## that class is apparently not present in export and referencing it here creates a crash. static func get_dialogic_plugin() -> Node: - for child in Engine.get_main_loop().get_root().get_children(): + for child : Node in Engine.get_main_loop().get_root().get_children(): if child.get_class() == "EditorNode": - return child.get_node('DialogicPlugin') + return child.get_node(^'DialogicPlugin') return null #endregion @@ -24,25 +24,9 @@ static func get_dialogic_plugin() -> Node: static func autoload() -> DialogicGameHandler: if Engine.is_editor_hint(): return null - if not Engine.get_main_loop().root.has_node("Dialogic"): + if not Engine.get_main_loop().root.has_node(^"Dialogic"): return null - return Engine.get_main_loop().root.get_node("Dialogic") - - -static func get_text() -> DialogicSubsystemText: - return DialogicUtil.autoload().Text - - -static func get_input() -> DialogicSubsystemInput: - return DialogicUtil.autoload().Input - - -static func get_glossary() -> DialogicSubsystemGlossary: - return DialogicUtil.autoload().Glossary - - -static func get_history() -> DialogicSubsystemHistory: - return DialogicUtil.autoload().History + return Engine.get_main_loop().root.get_node(^"Dialogic") #region FILE SYSTEM diff --git a/addons/dialogic/Resources/dialogic_layout_base.gd b/addons/dialogic/Resources/dialogic_layout_base.gd index a89fbed24..77cecfbe4 100644 --- a/addons/dialogic/Resources/dialogic_layout_base.gd +++ b/addons/dialogic/Resources/dialogic_layout_base.gd @@ -1,6 +1,6 @@ @tool class_name DialogicLayoutBase -extends CanvasLayer +extends Node ## Base class that should be extended by custom layouts. diff --git a/addons/dialogic/Resources/dialogic_style.gd b/addons/dialogic/Resources/dialogic_style.gd index 4256864a5..ccd48f3df 100644 --- a/addons/dialogic/Resources/dialogic_style.gd +++ b/addons/dialogic/Resources/dialogic_style.gd @@ -86,9 +86,6 @@ func move_layer(from_index:int, to_index:int) -> void: if not has_layer(from_index) or not has_layer(to_index-1): return - if from_index < to_index: - to_index -1 - var info: DialogicLayoutLayer = layers.pop_at(from_index) layers.insert(to_index, info) changed.emit()