new timer + save times to save files (#3)
This commit is contained in:
parent
7ae566720c
commit
ac1f29d111
7 changed files with 269 additions and 37 deletions
|
@ -19,9 +19,7 @@ func ensure_existence(save_file_name: String) -> void:
|
|||
|
||||
func empty(save_file_name: String) -> void:
|
||||
print("Writing an empty object on ", save_file_name)
|
||||
var save_file := FileAccess.open(save_file_name, FileAccess.WRITE)
|
||||
save_file.store_line(JSON.stringify({}))
|
||||
save_file.store_line("FOR YOUR SAFETY, ALWAYS CHECK IF THE DATA OF THE FILES YOU DOWNLOAD LOOKS OKAY")
|
||||
write(JSON.stringify({}), save_file_name)
|
||||
|
||||
func read(save_file_name: String) -> Variant:
|
||||
ensure_existence(save_file_name)
|
||||
|
@ -36,3 +34,14 @@ func read(save_file_name: String) -> Variant:
|
|||
return {}
|
||||
|
||||
return json.data
|
||||
|
||||
func write(json_string: String, save_file_name: String) -> void:
|
||||
var save_file := FileAccess.open(save_file_name, FileAccess.WRITE)
|
||||
save_file.store_line(json_string)
|
||||
save_file.store_line("FOR YOUR SAFETY, ALWAYS CHECK IF THE DATA OF THE FILES YOU DOWNLOAD LOOKS OKAY")
|
||||
|
||||
func change_property(property: String, value, save_file_name: String) -> void:
|
||||
ensure_existence(save_file_name)
|
||||
var data = read(save_file_name)
|
||||
data[property] = value
|
||||
write(JSON.stringify(data), save_file_name)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue