Profile creating/loading in menu adjustments
This commit is contained in:
parent
cf4687350d
commit
ff19560f0b
4 changed files with 36 additions and 4 deletions
|
|
@ -28,7 +28,6 @@ metadata/_edit_horizontal_guides_ = []
|
|||
[node name="PrimaryWeapon" type="Node2D" parent="."]
|
||||
|
||||
[node name="SingleLaser" parent="PrimaryWeapon" instance=ExtResource("4_s724s")]
|
||||
position = Vector2(8, 0)
|
||||
|
||||
[node name="SecondaryWeapon" type="Node2D" parent="."]
|
||||
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ static func profile_delete(profile_name : String) -> void:
|
|||
static func profile_legit_check(profile_meta : Dictionary) -> Dictionary:
|
||||
var old_hash = []
|
||||
var new_hash = []
|
||||
if profile_meta == {}:
|
||||
return {}
|
||||
for key in profile_meta['meta']:
|
||||
old_hash.append(profile_meta['hash'][key])
|
||||
new_hash.append((str(profile_meta['meta'][key]) + salt).sha256_buffer().hex_encode())
|
||||
|
|
|
|||
|
|
@ -16,7 +16,9 @@ func _ready():
|
|||
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)
|
||||
change_menu(0)
|
||||
else:
|
||||
change_menu(5)
|
||||
profile_status.text = "Current profile: [{profile}]".format({"profile": Game.profile.profile_meta['meta']['profile_name']})
|
||||
|
||||
func change_menu(id):
|
||||
|
|
@ -42,6 +44,7 @@ func change_menu(id):
|
|||
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"
|
||||
|
|
@ -50,12 +53,21 @@ func change_menu(id):
|
|||
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()
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ var texts = {
|
|||
"Back" : "Back",
|
||||
"Play" : "Play",
|
||||
"LoadGame" : "Load from Profile",
|
||||
"FirstCreateProfileConfirm" : "Confirm",
|
||||
"Null" : Game.gameversion
|
||||
}
|
||||
|
||||
|
|
@ -34,17 +35,35 @@ func _on_button_up():
|
|||
var profile_name = controller.input.text
|
||||
Game.profile_create(profile_name)
|
||||
Game.profile_load(profile_name)
|
||||
controller.input.text = ""
|
||||
"FirstCreateProfileConfirm":
|
||||
Game.profile_create("")
|
||||
Game.profile = Profile.create(Game.profile_load(""))
|
||||
var profile_name = controller.input.text
|
||||
Game.profile.profile_meta['meta']['last_profile'] = profile_name
|
||||
Game.profile_save(get_tree().current_scene)
|
||||
Game.profile_create(profile_name)
|
||||
var profile_meta = Game.profile_load(profile_name)
|
||||
Game.profile_save(get_tree().current_scene)
|
||||
Game.profile = Profile.create(profile_meta)
|
||||
var format = {"profile": Game.profile.profile_meta['meta']['profile_name']}
|
||||
controller.profile_status.text = "Current profile: [{profile}]".format(format)
|
||||
controller.change_menu(0)
|
||||
"LoadProfileConfirm":
|
||||
var profile_name = controller.input.text
|
||||
var profile_meta = Game.profile_legit_check(Game.profile_load(profile_name))
|
||||
controller.input.text = ""
|
||||
if profile_meta != {}:
|
||||
if !Game.profile.is_root:
|
||||
Game.profile = Profile.create(Game.profile_load(""))
|
||||
Game.profile.profile_meta['meta']['last_profile'] = profile_name
|
||||
controller.input.placeholder_text = "Loaded profile {profile}.".format({"profile": profile_name})
|
||||
Game.profile_save(get_tree().current_scene)
|
||||
Game.profile = Profile.create(profile_meta)
|
||||
else:
|
||||
controller.input.placeholder_text = "Could not load the given profile."
|
||||
var format = {"profile": Game.profile.profile_meta['meta']['profile_name']}
|
||||
controller.profile_status.text = "Current profile: [{profile}]".format(format)
|
||||
"DeleteProfile":
|
||||
Game.profile_delete("1")
|
||||
"ExitGame":
|
||||
get_tree().quit()
|
||||
"Profiles":
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue