Skip to content

Commit

Permalink
Added types to the textbubble and speaker_textbubble examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nlupugla committed Jan 4, 2024
1 parent 9491815 commit a3ea87a
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 32 deletions.
16 changes: 8 additions & 8 deletions addons/dialogic/Modules/History/subsystem_history.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand Down
24 changes: 4 additions & 20 deletions addons/dialogic/Other/DialogicUtil.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion addons/dialogic/Resources/dialogic_layout_base.gd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@tool
class_name DialogicLayoutBase
extends CanvasLayer
extends Node

## Base class that should be extended by custom layouts.

Expand Down
3 changes: 0 additions & 3 deletions addons/dialogic/Resources/dialogic_style.gd
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down

0 comments on commit a3ea87a

Please sign in to comment.