extends AudibleButton

onready var selected_screen_base_path: String = "res://src/UserInterface/Screens"
onready var signal_manager := get_tree().root.get_child(4).get_node("%SignalManager")
onready var mapper := $"%InputMapper"
export(String, FILE) var next_screen_path: = ""

func _on_button_up() -> void:
  signal_manager.connect("savemanager_saved",self,"was_saved_now_quit")
  mapper.commit_to_changes()
  SaveManager.save_default()

func was_saved_now_quit() -> void:
  $"%ReallyQuitMenu".close()
  $"%ControlsMenu".changes_made = false
  $"%ControlsMenu".changes_saved = true
  $"%ControlsMenu".close()
  $"%Continue".grab_focus()

func _get_configuration_warning() -> String:
  return "next_scene_path must be set for the button to work" if next_screen_path == "" else ""
