- All Known Implementing Classes:
FileSaveStorage
public interface SaveStorage
SaveStorage defines the API for a storage mechanism for persisting game saves.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final StringThe default save directory.static final SolaLoggerASolaLoggerused for default onFailure handlers. -
Method Summary
Modifier and TypeMethodDescriptionvoidchangeSaveDirectory(String path) Changes the directory in which saves are stored.default voidDeletes a save.default voidDeletes a save.voidDeletes a save.booleanChecks if a save exists.default voidLoads a save.voidLoads a save.default voidPersists a save.default voidPersists a save.voidPersists a save.default voidPersists a save.
-
Field Details
-
DEFAULT_SAVE_DIRECTORY
The default save directory.- See Also:
-
LOGGER
ASolaLoggerused for default onFailure handlers.
-
-
Method Details
-
changeSaveDirectory
Changes the directory in which saves are stored.- Parameters:
path- the path to where saves should be stored
-
load
Loads a save. The loaded save will be passed to the onSuccess callback.- Parameters:
path- the path to the saveonSuccess- callback that is called when the save is loaded successfullyonFailure- callback that is called when the save fails to load
-
load
Loads a save. The loaded save will be passed to the onSuccess callback.- Parameters:
path- the path to the saveonSuccess- callback that is called when the save is loaded successfully
-
save
Persists a save.- Parameters:
path- the path to the savecontent- the content of the save to be persistedonSuccess- callback that is called when the save is persisted successfullyonFailure- callback that is called when the save fails to persist
-
save
Persists a save.- Parameters:
path- the path to the savecontent- the content of the save to be persistedonSuccess- callback that is called when the save is persisted successfully
-
save
Persists a save.- Parameters:
path- the path to the savecontent- the content of the save to be persistedonFailure- callback that is called when the save fails to persist
-
save
Persists a save.- Parameters:
path- the path to the savecontent- the content of the save to be persisted
-
delete
Deletes a save.- Parameters:
path- the path to the saveonSuccess- the callback that is called when the save is deleted successfullyonFailure- the callback that is called when the save fails to delete
-
delete
Deletes a save.- Parameters:
path- the path to the saveonSuccess- the callback that is called when the save is deleted successfully
-
delete
Deletes a save.- Parameters:
path- the path to the save
-
exists
Checks if a save exists.- Parameters:
path- the path to the save- Returns:
- true if the save exists
-