settings_menu.gd 880 B

12345678910111213141516171819202122232425262728
  1. extends PanelContainer
  2. const GENERAL = "GENERAL"
  3. const SHOW_TUTORIAL = "SHOW_TUTORIAL"
  4. @onready var show_tutorial = $MarginContainer/VBoxContainer/Tabs/General/GridContainer/TutorialCheckBox
  5. @onready var discard_button = $MarginContainer/VBoxContainer/Buttons/Discard
  6. func _ready():
  7. discard_button.text = "BACK"
  8. show_tutorial.button_pressed = Config.show_tutorial
  9. func _process(_delta):
  10. if Input.is_action_just_pressed("ui_cancel"):
  11. self._on_discard_pressed()
  12. func _on_discard_pressed():
  13. get_tree().change_scene_to_file("res://screens/main_menu.tscn")
  14. func _on_save_pressed():
  15. Config.show_tutorial = show_tutorial.button_pressed
  16. Config.save()
  17. get_tree().change_scene_to_file("res://screens/main_menu.tscn")
  18. func update_discard_button():
  19. var dirty = \
  20. Config.show_tutorial != show_tutorial.button_pressed
  21. discard_button.text = "DISCARD" if dirty else "BACK"