40 lines
870 B
GDScript
40 lines
870 B
GDScript
extends CanvasLayer
|
|
|
|
export (String, FILE, "*.txt") var dialog_path;
|
|
|
|
onready var dialog_box = get_node("dialog_box")
|
|
|
|
func _ready():
|
|
|
|
# start signal
|
|
get_parent().connect("on_scene_ready", self, "_on_scene_ready")
|
|
get_parent().connect("on_scene_start", self, "_on_scene_start")
|
|
|
|
dialog_box.connect("on_dialog_init", self, "_on_dialog_init")
|
|
dialog_box.connect("on_dialog_completed", self, "_on_dialog_completed")
|
|
|
|
# set up params
|
|
dialog_box.set_dialog_path(dialog_path)
|
|
dialog_box.set_get_character_function(funcref(self, "_on_get_character"))
|
|
|
|
|
|
func _on_get_character(char_name):
|
|
return get_parent().get_node(char_name)
|
|
|
|
func _on_scene_ready():
|
|
|
|
# init after yes
|
|
dialog_box.initialize_dialog()
|
|
|
|
|
|
func _on_scene_start():
|
|
|
|
# then entero
|
|
dialog_box.enter_frame()
|
|
|
|
|
|
func _on_dialog_init(d):
|
|
pass
|
|
|
|
func _on_dialog_completed(d):
|
|
dialog_box.exit_frame() |