77 lines
1.9 KiB
GDScript
77 lines
1.9 KiB
GDScript
extends Node2D
|
|
|
|
var map_width = 1280
|
|
var map_height = 720
|
|
var menu_id = 0
|
|
@onready var b1 = $Control/MenuButton1
|
|
@onready var b2 = $Control/MenuButton2
|
|
@onready var b3 = $Control/MenuButton3
|
|
@onready var b4 = $Control/MenuButton4
|
|
@onready var b5 = $Control/MenuButton5
|
|
@onready var profile_status = $Control/ProfileStatus
|
|
@onready var input = $Control/Input
|
|
|
|
func _ready():
|
|
var profile_meta = Game.profile_load("")
|
|
if profile_meta != {} and profile_meta['meta'].has('last_profile'):
|
|
profile_meta = Game.profile_load(profile_meta['meta']['last_profile'])
|
|
Game.profile = Profile.create(profile_meta)
|
|
change_menu(0)
|
|
else:
|
|
change_menu(5)
|
|
var format = {"profile": Game.profile.profile_meta['meta']['profile_name']}
|
|
profile_status.text = "Current profile: [{profile}]".format(format)
|
|
|
|
func change_menu(id):
|
|
input.visible = false
|
|
match id:
|
|
0: # Main
|
|
b1.id = "Play"
|
|
b2.id = "Profiles"
|
|
b3.id = "Settings"
|
|
b4.id = "Credits"
|
|
b5.id = "ExitGame"
|
|
1: # Profiles
|
|
b1.id = "CreateProfile"
|
|
b2.id = "LoadProfile"
|
|
b3.id = "Back"
|
|
b4.id = "Null"
|
|
b5.id = "Null"
|
|
2: # Create Profile
|
|
b1.id = "Null"
|
|
b2.id = "CreateProfileConfirm"
|
|
b3.id = "Back"
|
|
b4.id = "Null"
|
|
b5.id = "Null"
|
|
input.visible = true
|
|
input.text = ""
|
|
input.placeholder_text = "Enter your profile name here!"
|
|
3: # Load Profile
|
|
b1.id = "Null"
|
|
b2.id = "LoadProfileConfirm"
|
|
b3.id = "Back"
|
|
b4.id = "Null"
|
|
b5.id = "Null"
|
|
input.visible = true
|
|
input.text = ""
|
|
input.placeholder_text = "Enter your profile name here!"
|
|
4: # Play Menu
|
|
b1.id = "LoadGame"
|
|
b2.id = "NewGame"
|
|
b3.id = "Back"
|
|
b4.id = "Null"
|
|
b5.id = "Null"
|
|
5: # First-timer Create Profile
|
|
b1.id = "Null"
|
|
b2.id = "FirstCreateProfileConfirm"
|
|
b3.id = "Null"
|
|
b4.id = "Null"
|
|
b5.id = "Null"
|
|
input.visible = true
|
|
input.text = ""
|
|
b1.change_name()
|
|
b2.change_name()
|
|
b3.change_name()
|
|
b4.change_name()
|
|
b5.change_name()
|
|
menu_id = id
|