channel-switcher/menu/menu.gd

49 lines
1.1 KiB
GDScript3
Raw Normal View History

2025-05-16 22:13:34 +10:00
extends Control
2025-05-17 16:03:39 +10:00
enum Page{
Menu,
Credits
}
var menu_page : Page = Page.Menu
@export var menu_container : Control
@export var credits_container : Control
@export var exit_button : Button
2025-05-16 22:13:34 +10:00
# Called when the node enters the scene tree for the first time.
func _ready() -> void:
pass # Replace with function body.
2025-05-17 16:03:39 +10:00
if OS.get_name() == "Web":
exit_button.hide()
2025-05-16 22:13:34 +10:00
# Called every frame. 'delta' is the elapsed time since the previous frame.
func _process(delta: float) -> void:
2025-05-17 16:03:39 +10:00
menu_container.visible = menu_page == Page.Menu
credits_container.visible = menu_page == Page.Credits
2025-05-16 22:13:34 +10:00
func _on_intro_button_pressed() -> void:
GameManager.are_we_skipping_intro = false
get_tree().change_scene_to_file("res://game_scene.tscn")
func _on_skip_button_pressed() -> void:
GameManager.are_we_skipping_intro = true
get_tree().change_scene_to_file("res://game_scene.tscn")
2025-05-17 16:03:39 +10:00
func _on_credits_meta_clicked(meta: Variant) -> void:
OS.shell_open(str(meta))
func _on_credits_button_pressed() -> void:
menu_page = Page.Credits
func _on_back_button_pressed() -> void:
menu_page = Page.Menu
2025-05-17 16:07:35 +10:00
func _on_exit_button_pressed() -> void:
get_tree().quit()