cosmic/scripts/menu/MainMenuButton.gd
2023-11-08 09:49:00 +03:00

54 lines
1 KiB
GDScript

extends Button
@export var id = "Null"
@onready var controller = $"../.."
func _ready():
button_up.connect(_on_button_up)
change_name()
func _on_button_up():
match id:
"NewGame":
get_tree().change_scene_to_file("res://scenes/Space.tscn")
"CreateProfile":
Game.profile_create("1")
"LoadProfile":
Game.profile_legit_check(Game.profile_load("1"))
"DeleteProfile":
Game.profile_delete("1")
"ExitGame":
get_tree().quit()
"Profiles":
controller.change_menu(1)
"Back":
var new_menu_id = 0
controller.change_menu(new_menu_id)
func change_name():
visible = true
match id:
"NewGame":
text = "New Game"
"CreateProfile":
text = "Create Profile"
"LoadProfile":
text = "Load Profile"
"DeleteProfile":
text = "Delete Profile"
"ExitGame":
text = "Exit Game"
"Settings":
text = "Settings (WIP)"
"AudioSettings":
text = "Audio (WIP)"
"VideoSettings":
text = "Video (WIP)"
"Profiles":
text = "Profiles (WIP)"
"Back":
text = "Back"
"Null":
text = Game.gameversion
visible = false