godot-vn/dialog_layer.gd

36 lines
718 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)
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()