diff options
| author | Jan Tuomi <jan.tuomi@valuemotive.com> | 2020-08-09 16:29:26 +0300 |
|---|---|---|
| committer | Jan Tuomi <jan.tuomi@valuemotive.com> | 2020-08-09 16:29:26 +0300 |
| commit | 08ae1a42c694ec409921225daa59ab42fac75d58 (patch) | |
| tree | 8130cc772a35cb081333d73c9015638e586aca41 /scripts/Game.gd | |
| parent | 1119130621fe5bbc048fb8404263acc65490d0cd (diff) | |
Allow options in dialoguemaster
Diffstat (limited to 'scripts/Game.gd')
| -rw-r--r-- | scripts/Game.gd | 18 |
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") + |
