forked from team-sg/hero-mark-2
make debug save only exist in debug and not count for continue button
This commit is contained in:
parent
bfbc0dfd2b
commit
74fd1ec4f2
2 changed files with 10 additions and 6 deletions
|
@ -79,8 +79,11 @@ class SaveFile:
|
|||
var play_time: float = 0.0
|
||||
# dictionary of levels' save data
|
||||
var levels: Dictionary
|
||||
# whether is debug save
|
||||
var debug: bool = false
|
||||
|
||||
func _init(path: String) -> void:
|
||||
func _init(path: String, debug_save: bool = false) -> void:
|
||||
debug = debug_save
|
||||
file_path = path
|
||||
# initialize level save data dictionary
|
||||
levels = {}
|
||||
|
@ -89,6 +92,8 @@ class SaveFile:
|
|||
|
||||
# return total number of shards
|
||||
func get_total_shards() -> int:
|
||||
if debug:
|
||||
return 999
|
||||
var total = 0
|
||||
for level in levels.values():
|
||||
total += level.shards_collected.count(true)
|
||||
|
@ -143,16 +148,16 @@ class SaveFile:
|
|||
level.save_to_file(file)
|
||||
file.save(file_path)
|
||||
|
||||
|
||||
## currently used save file
|
||||
var current_file: SaveFile = null
|
||||
|
||||
func _ready() -> void:
|
||||
# TODO: make load last played file
|
||||
current_file = load_file("user://file%d.pr" % Options.last_file)
|
||||
if current_file:
|
||||
Game.difficulty = current_file.difficulty
|
||||
else:
|
||||
current_file = SaveFile.new("user://testing.pr")
|
||||
elif OS.is_debug_build():
|
||||
current_file = SaveFile.new("user://debug_save.pr", true)
|
||||
|
||||
## shortcut for loading a save file from specific path
|
||||
func load_file(path: String) -> SaveFile:
|
||||
|
|
|
@ -6,8 +6,7 @@ func _ready():
|
|||
Fade.fade_in(Options.transition_speed_secs)
|
||||
#Grey out continue if no save files
|
||||
yield(get_tree(),"idle_frame")
|
||||
print(Save.current_file)
|
||||
if Save.current_file:
|
||||
if Save.current_file and not Save.current_file.debug:
|
||||
$Panel/Continue.grab_focus()
|
||||
else:
|
||||
$Panel/Body/GreyedContinue.visible = true
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue