summaryrefslogtreecommitdiffstats
path: root/scripts/Game.gd
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/Game.gd')
-rw-r--r--scripts/Game.gd18
1 files changed, 11 insertions, 7 deletions
diff --git a/scripts/Game.gd b/scripts/Game.gd
index 25edde0..d5f3bb5 100644
--- a/scripts/Game.gd
+++ b/scripts/Game.gd
@@ -52,20 +52,24 @@ func change_level(num: int):
func _on_PlayerCharacter_initiate_dialogue(other: Node):
in_dialogue_with = other
- var dialogues = other.get_dialogue()
+ var dialogues: Dictionary = other.get_dialogue()
$CanvasLayer/GUI/BottomRow/DialogueBox.set_visible(true)
emit_signal("dialogue_begin")
- for i in range(dialogues.size()):
- var d = dialogues[i]
+ var id = "1"
+ while id != null:
+ var d: Dictionary = dialogues[String(id)]
var name = d["name"]
var body = d["body"]
- $CanvasLayer/GUI/BottomRow/DialogueBox/Name.set_text(name)
- $CanvasLayer/GUI/BottomRow/DialogueBox/Text.set_text(body)
- print("[%s] %s" % [name, body])
- yield($CanvasLayer/GUI, "dialogue_next")
+ var options = d.get("options", [[">>", null]])
+ $CanvasLayer/GUI/BottomRow/DialogueBox.set_dialogue(name, body, options)
+ print("[%s] \"%s\"" % [name, body])
+ var next_target = yield($CanvasLayer/GUI, "dialogue_next")
+ id = next_target
emit_signal("dialogue_next")
in_dialogue_with = null
$CanvasLayer/GUI/BottomRow/DialogueBox.set_visible(false)
+ $CanvasLayer/GUI/BottomRow/DialogueBox.free_buttons()
emit_signal("dialogue_end")
+