Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.
 
 

28 rindas
698 B

  1. extends Node
  2. export var scenes : Dictionary
  3. signal end
  4. func _ready():
  5. $YarnRunnerNode.yarnRunner.add_command("Scene", funcref(self, "load_scene"))
  6. $YarnRunnerNode.yarnRunner.add_command("WaitSignal", funcref(self, "wait_signal"))
  7. yield($YarnRunnerNode.start_script(), "completed")
  8. func load_scene(args):
  9. yield(get_tree(),"idle_frame")
  10. if args.size() > 0:
  11. var scene_key = args[0]
  12. if scenes.has(scene_key):
  13. for child in $SceneContainer.get_children():
  14. child.queue_free()
  15. var scene = scenes[scene_key].instance()
  16. $SceneContainer.add_child(scene)
  17. func wait_signal(args):
  18. yield(self, "end")
  19. func _input(event):
  20. if event.is_action_pressed("ui_cancel"):
  21. emit_signal("end")