mirror of
https://github.com/HarmonyHoney/tiny_crate.git
synced 2026-01-23 02:34:53 +00:00
Shared.load_save() on select _ready()
remove is_load argument from load_save()
This commit is contained in:
parent
9b6804ea20
commit
2c48fd462c
3 changed files with 7 additions and 6 deletions
|
|
@ -355,13 +355,13 @@ func delete_slot(_slot := save_slot):
|
|||
dir.remove(fname)
|
||||
fname = dir.get_next()
|
||||
|
||||
replays[_slot] = {}
|
||||
replays[_slot] = {}
|
||||
load_save(_slot)
|
||||
|
||||
func save_replays(arg := replay_map, _slot := save_slot):
|
||||
save_file(save_path + str(_slot) + "/" + arg + ".save", JSON.print(replays[save_slot][arg], "\t"))
|
||||
|
||||
func load_save(_slot = save_slot, is_reload := false):
|
||||
func load_save(_slot = save_slot):
|
||||
save_slot = clamp(_slot, 0, save_limit - 1)
|
||||
var save_string = save_path + str(save_slot) + "/" + save_filename
|
||||
|
||||
|
|
@ -374,14 +374,13 @@ func load_save(_slot = save_slot, is_reload := false):
|
|||
save_clock = 0.0
|
||||
|
||||
var dict := {}
|
||||
if is_reload: dict = save_data[_slot]
|
||||
|
||||
if dict.empty():
|
||||
var l = load_file(save_string)
|
||||
if l: dict = JSON.parse(l).result
|
||||
else: print(save_string + " not found")
|
||||
|
||||
print(_slot, " / ", dict)
|
||||
print(save_slot, " / ", dict)
|
||||
if !dict.empty():
|
||||
if dict.has("clock"):
|
||||
save_clock = dict["clock"]
|
||||
|
|
|
|||
|
|
@ -138,10 +138,10 @@ func menu_select(tag : String = menu_items[clamp(cursor, 0, menu_items.size() -
|
|||
TouchScreen.show_keys()
|
||||
"yes":
|
||||
Audio.play("menu_yes", 0.9, 1.1)
|
||||
menu_stuff[cursor].text = "quit!!"
|
||||
if OS.get_name() == "HTML5":
|
||||
Shared.wipe_scene(Shared.splash_path)
|
||||
else:
|
||||
menu_stuff[cursor].text = "quit!!"
|
||||
Shared.wipe_quit()
|
||||
"no":
|
||||
switch_menu("main")
|
||||
|
|
@ -206,7 +206,7 @@ func switch_menu(arg, silent := false, _cursor := 0):
|
|||
Shared.map_select = 0
|
||||
user_label.visible = true
|
||||
"open":
|
||||
Shared.load_save(Shared.last_slot, true)
|
||||
Shared.load_save(Shared.last_slot)
|
||||
Player.set_palette(open_player_mat, Shared.player_colors)
|
||||
Player.set_palette(demo_player_mat, Shared.player_colors)
|
||||
if menu_last == "erase":
|
||||
|
|
|
|||
|
|
@ -69,6 +69,8 @@ var actor_lerp := 0.1
|
|||
var actor_jump := 0.5
|
||||
|
||||
func _ready():
|
||||
Shared.load_save()
|
||||
|
||||
screen = screen.duplicate()
|
||||
$"%Screen".queue_free()
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue