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.

67 lines
1.7 KiB

  1. extends Control
  2. onready var player_settings = find_node("settings_player")
  3. onready var game_tab = find_node("game")
  4. onready var controls_tab = find_node("controls")
  5. onready var graphics_tab = find_node("graphics")
  6. onready var system_tab = find_node("system")
  7. var locale
  8. func _ready():
  9. get_node("menu/back").connect("pressed",self,"_on_back_pressed")
  10. find_node("bots").set_pressed(local_storage.read_value("bots", true))
  11. game_tab.set_name(tr("GAME"))
  12. controls_tab.set_name(tr("CONTROLS"))
  13. graphics_tab.set_name(tr("GRAPHICS"))
  14. system_tab.set_name(tr("SYSTEM"))
  15. func _on_back_pressed():
  16. queue_free()
  17. get_tree().get_root().get_node("main_menu").show()
  18. func _on_locales_item_selected(index):
  19. match index:
  20. 0:
  21. locale = "en"
  22. 1:
  23. locale = "de"
  24. _:
  25. locale = "en"
  26. TranslationServer.set_locale(locale)
  27. game_tab.set_name(tr("GAME"))
  28. controls_tab.set_name(tr("CONTROLS"))
  29. graphics_tab.set_name(tr("GRAPHICS"))
  30. system_tab.set_name(tr("SYSTEM"))
  31. func _init_locales():
  32. var locales = find_node("locales")
  33. locales.clear()
  34. locales.add_item(tr("LOCALE_EN"))
  35. locales.add_item(tr("LOCALE_DE"))
  36. locale = local_storage.read_value("locale","en")
  37. match locale:
  38. "en":
  39. locales.select(0)
  40. _on_locales_item_selected(0)
  41. "de":
  42. locales.select(1)
  43. _on_locales_item_selected(1)
  44. func _on_locales_tree_exiting():
  45. TranslationServer.set_locale(local_storage.read_value("locale","en"))
  46. func _on_save_pressed():
  47. var values = {}
  48. values['player_name'] = player_settings.get_name_node().text
  49. values['player_color'] = player_settings.get_color_node().color.to_html()
  50. values['bots'] = find_node("bots").is_pressed()
  51. values['locale'] = locale
  52. local_storage.write_values(values)
  53. _on_back_pressed()