Adventure Creator 1.84.3
An adventure game toolkit for Unity, by Chris Burton, ICEBOX Studios 2013-2024
Loading...
Searching...
No Matches
AC.iSaveFileHandler Interface Reference
Inheritance diagram for AC.iSaveFileHandler:
AC.SaveFileHandler_PlayerPrefs AC.SaveFileHandler_SystemFile

Public Member Functions

string GetDefaultSaveLabel (int saveID)
 Returns the default label of a save file. This is not the same as the filename - it is what's displayed in SavesList menus.
void DeleteAll (int profileID)
 Deletes all save files associated with a given profile.
void Delete (SaveFile saveFile, System.Action< bool > callback=null)
 Deletes a single save file.
bool SupportsSaveThreading ()
void Save (SaveFile saveFile, string dataToSave, System.Action< bool > callback)
 Requests that game data be saved to disk. When saving is complete, it needs to confirm the output to SaveSystem.OnCompleteSave for the save to be recorded.
void Load (SaveFile saveFile, bool doLog, System.Action< SaveFile, string > callback)
 Requests that save game data be loaded from disk. The resulting data needs to be sent back to SaveSystem.ReceiveLoadedData for it to actually be processed.
void GatherSaveFiles (int profileID, System.Action< List< SaveFile > > callback)
 Reads the disk for all save files associated with a given profile.
SaveFile GetSaveFile (int saveID, int profileID)
 Reads the disk for a save file with a specific ID.
void GatherImportFiles (int profileID, int boolID, string separateProductName, string separateFilePrefix, System.Action< List< SaveFile > > callback)
 Reads the disk for all save files associated with a given profile from another game, to allow for the importing of data between games.
void SaveScreenshot (SaveFile saveFile)
 Saves a screenshot associated with a save file.

Detailed Description

An interface for classes that handle the creation, deletion, and loading of save-game files. This is can be overriden in the SaveSystem to allow for custom save file handling.

To override the handling of save files, create a new class that implements iSaveFileHandler, and assign it with:

SaveSystem.SaveFileHandler = new MyClassName ();
static iSaveFileHandler SaveFileHandler
Definition SaveSystem.cs:2629

Where MyClassName is the name of your class.

To have this code run when the game begins, place it in the Awake function of a script in your game's first scene.

Member Function Documentation

◆ Delete()

void AC.iSaveFileHandler.Delete ( SaveFile saveFile,
System.Action< bool > callback = null )

Deletes a single save file.

Parameters
saveFileThe SaveFile container which stores information about the save to delete
callbackAn optional callback that contains a bool that's True if the delete was succesful

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ DeleteAll()

void AC.iSaveFileHandler.DeleteAll ( int profileID)

Deletes all save files associated with a given profile.

Parameters
profileIDThe ID number of the profile to delete saves for, or 0 if profiles are not enabled.

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ GatherImportFiles()

void AC.iSaveFileHandler.GatherImportFiles ( int profileID,
int boolID,
string separateProductName,
string separateFilePrefix,
System.Action< List< SaveFile > > callback )

Reads the disk for all save files associated with a given profile from another game, to allow for the importing of data between games.

Parameters
profileIDThe ID number of the profile to search save files for, or 0 if profiles are not enabled
boolIDThe ID number of the Global Boolean variable that must be true in the file's data in order for it to be included, or -1 if this feature is not used
separateProductNameThe 'Product name' of the Unity product to import files from
separateFilePrefixThe 'Save filename' field of the AC project to import files from, as set in the Settings Manager
Returns
A List of SaveFile instances, with each instance storing information about each found save file

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ GatherSaveFiles()

void AC.iSaveFileHandler.GatherSaveFiles ( int profileID,
System.Action< List< SaveFile > > callback )

Reads the disk for all save files associated with a given profile.

Parameters
profileIDThe ID number of the profile to search save files for, or 0 if profiles are not enabled
Returns
A List of SaveFile instances, with each instance storing information about each found save file

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ GetDefaultSaveLabel()

string AC.iSaveFileHandler.GetDefaultSaveLabel ( int saveID)

Returns the default label of a save file. This is not the same as the filename - it is what's displayed in SavesList menus.

Parameters
saveIDThe ID number of the save game
Returns
The save file's default label

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ GetSaveFile()

SaveFile AC.iSaveFileHandler.GetSaveFile ( int saveID,
int profileID )

Reads the disk for a save file with a specific ID.

Parameters
saveIDThe ID number of the save to search for
profileIDThe ID number of the save file's associated profile, or 0 if profiles are not enabled
Returns
A SaveFile instances, if the save was found

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ Load()

void AC.iSaveFileHandler.Load ( SaveFile saveFile,
bool doLog,
System.Action< SaveFile, string > callback )

Requests that save game data be loaded from disk. The resulting data needs to be sent back to SaveSystem.ReceiveLoadedData for it to actually be processed.

Parameters
saveFileThe SaveFile container which stores information about the save to load
doLogIf True, a log should be shown in the Console once the data has been read
callbackA callback containing the SaveFile, and the save-data string

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ Save()

void AC.iSaveFileHandler.Save ( SaveFile saveFile,
string dataToSave,
System.Action< bool > callback )

Requests that game data be saved to disk. When saving is complete, it needs to confirm the output to SaveSystem.OnCompleteSave for the save to be recorded.

Parameters
saveFileThe SaveFile container which stores information about the file. Note that only the saveID, profileID and label have been correctly assigned by this point
dataToSaveThe data to save, as a serialized string
callbackA callback containing a bool that's True if the save was successful

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ SaveScreenshot()

void AC.iSaveFileHandler.SaveScreenshot ( SaveFile saveFile)

Saves a screenshot associated with a save file.

Parameters
saveFileA data container for both the texture, and the associate save/profile IDs

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.

◆ SupportsSaveThreading()

bool AC.iSaveFileHandler.SupportsSaveThreading ( )

Returns true if threading is supported when saving to disk

Implemented in AC.SaveFileHandler_PlayerPrefs, and AC.SaveFileHandler_SystemFile.