diff options
author | Spartan322 <Megacake1234@gmail.com> | 2023-06-03 20:37:10 +0200 |
---|---|---|
committer | Spartan322 <Megacake1234@gmail.com> | 2023-06-03 20:37:10 +0200 |
commit | cef940108fe15752c3ef66f43f5169403fa2f71d (patch) | |
tree | fe4de5a05830e3bddeae78f74f729503b7cee1e9 /game/src/SaveLoadMenu/SaveResource.gd | |
parent | 73e29d02e48739aba5ca5db1b9575c67e795400f (diff) |
Reorganize the file structure of the files in `game/src`
Diffstat (limited to 'game/src/SaveLoadMenu/SaveResource.gd')
-rw-r--r-- | game/src/SaveLoadMenu/SaveResource.gd | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/game/src/SaveLoadMenu/SaveResource.gd b/game/src/SaveLoadMenu/SaveResource.gd deleted file mode 100644 index 5e7faa6..0000000 --- a/game/src/SaveLoadMenu/SaveResource.gd +++ /dev/null @@ -1,59 +0,0 @@ -extends Resource -class_name SaveResource - -signal file_flushed(path : String) -signal file_loaded -signal file_moved_to_trash -signal file_deleted -signal trash_moved -signal deleted - -var save_name : StringName: - get: return save_name - set(v): - save_name = v - file.set_value("Save", "name", save_name) - emit_changed() -var session_tag : StringName: - get: return session_tag - set(v): - session_tag = v - file.set_value("Save", "session_tag", v) - emit_changed() -var file_path : String: - get: return file_path - set(v): - file_path = v - emit_changed() -var file : ConfigFile = ConfigFile.new() - -func set_file_path(name : StringName, path : String): - file_path = path - save_name = name - -func flush_save() -> Error: - file_flushed.emit(file_path) - var result := file.save(file_path) - file.clear() - return result - -func load_save(path : String = file_path) -> Error: - file_loaded.emit() - var result := file.load(path) - session_tag = file.get_value("Save", "session_tag", session_tag) - if path != file_path: - set_file_path(file.get_value("Save", "name", save_name), path) - return result - -func get_save_file_time() -> int: - return FileAccess.get_modified_time(file_path) - -func move_to_trash() -> Error: - trash_moved.emit() - file_moved_to_trash.emit() - return OS.move_to_trash(file_path) - -func delete() -> Error: - deleted.emit() - file_deleted.emit() - return DirAccess.remove_absolute(file_path) |