No Description
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

Main.gd 1.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051
  1. extends Node
  2. onready var mini_game = $MiniGame;
  3. var dialogic_node: Control;
  4. # Called when the node enters the scene tree for the first time.
  5. func _ready():
  6. start_dialog('_start')
  7. func _on_Dialogic_signal_received(value: String):
  8. print("signal received")
  9. var args = value.split(" ")
  10. if args.size() > 0:
  11. var type = args[0];
  12. match type:
  13. "start_minigame":
  14. start_minigame()
  15. "setup_minigame":
  16. if (args.size() >= 3):
  17. setup_minigame(args[1], args[2])
  18. else:
  19. print("not enough arguments for start_minigame")
  20. _:
  21. print("wrong type")
  22. func close_dialog():
  23. dialogic_node.queue_free()
  24. func start_dialog(timeline: String):
  25. dialogic_node = Dialogic.start(timeline)
  26. add_child_below_node(mini_game, dialogic_node)
  27. dialogic_node.connect('dialogic_signal', self, "_on_Dialogic_signal_received")
  28. func setup_minigame(mode: String, next_timeline: String):
  29. mini_game.setup(mode, next_timeline)
  30. func start_minigame():
  31. close_dialog()
  32. mini_game.start()
  33. func _on_MiniGame_game_over(next_timeline: String):
  34. print("Game over received")
  35. print("next timeline: " + next_timeline)
  36. start_dialog(next_timeline)