extends AudibleButton

onready var selected_screen_base_path: String = "res://src/UserInterface/Screens"
onready var signal_manager := $"%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:
    get_tree().change_scene(next_screen_path)
    get_tree().get_current_scene().queue_free()
    get_tree().paused = false

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