Public repository for MUR pre alpha
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.

50 lines
1.1 KiB

  1. extends Control
  2. var MultiplayerMenu = preload("res://scenes/menus/MultiplayerMenu.tscn")
  3. var LocalGameMenu = preload("res://scenes/menus/LocalGameMenu.tscn")
  4. var SettingsMenu = preload("res://scenes/menus/SettingsMenu.tscn")
  5. func _ready():
  6. gamestate.connect("server_disconnected", self, "_server_disconnected")
  7. func _draw():
  8. find_node("multiplayer").grab_focus()
  9. func _on_multiplayer_pressed():
  10. var multiplayer_menu = MultiplayerMenu.instance()
  11. get_tree().get_root().add_child(multiplayer_menu)
  12. hide()
  13. func _on_practice_pressed():
  14. var local_game_menu = LocalGameMenu.instance()
  15. get_tree().get_root().add_child(local_game_menu)
  16. hide()
  17. func _on_settings_pressed():
  18. var settings_menu = SettingsMenu.instance()
  19. get_tree().get_root().add_child(settings_menu)
  20. hide()
  21. func _on_quit_pressed():
  22. get_tree().quit()
  23. func _server_disconnected():
  24. show_error_dialog(tr("SERVER_DISCONNECTED"))
  25. func show_error_dialog(text:String):
  26. var dialog = get_node("error_dialog")
  27. dialog.set_text(text)
  28. dialog.popup_centered()
  29. func _on_info_pressed():
  30. var dialog = get_node("info_popup")
  31. dialog.popup_centered()