Files
2025-12-26 16:12:46 +03:00

55 lines
1.2 KiB
GDScript

extends Control
signal continue_game
signal show_main_menu
signal show_options
@onready var continue_button := $%ContinueButton
@onready var main_menu_button := $%MainMenuButton
func _ready() -> void:
_init_focus()
_setup_neighbors()
func _input(event: InputEvent) -> void:
if event.is_action_pressed("ui_up"):
SoundManager.play_ui_stream(SoundManager.ui_stream_previous)
if event.is_action_pressed("ui_down"):
SoundManager.play_ui_stream(SoundManager.ui_stream_next)
func _on_visibility_changed() -> void:
if not is_node_ready(): return
if not visible: return
_init_focus()
_setup_neighbors()
func _init_focus() -> void:
continue_button.grab_focus()
func _setup_neighbors() -> void:
continue_button.focus_neighbor_top = main_menu_button.get_path()
main_menu_button.focus_neighbor_bottom = continue_button.get_path()
func _on_continue_button_pressed() -> void:
SoundManager.play_ui_stream(SoundManager.ui_stream_accept)
continue_game.emit()
func _on_options_button_pressed() -> void:
SoundManager.play_ui_stream(SoundManager.ui_stream_accept)
show_options.emit()
func _on_main_menu_button_pressed() -> void:
SoundManager.play_ui_stream(SoundManager.ui_stream_accept)
show_main_menu.emit()