Manages persistent game and scene data saving and loading. Uses JSON serialization and optionally AES encryption.
More...
|
void | Save (int slot=0) |
| Saves the current game and scene state to a file.
|
|
void | Load (int slot=0) |
| Loads the saved state from a slot.
|
|
List< int > | GetAvailableSaveSlots () |
| Scans the persistent data path for existing save files and returns a list of available save slot numbers (e.g., 0, 1, 2).
|
|
|
void | Awake () |
| Initializes the system, setting up the Singleton and JSON serializer.
|
|
void | CollectData () |
| Collects data marked with persistent attributes and stores them in gameData or sceneData, updating only the current scene and preserving the rest.
|
|
void | ApplyData () |
| Applies the loaded data to scene objects.
|
|
bool | ApplyEntriesToObjects (List< DataEntry > entries, bool isSceneData) |
|
bool | HasGamePersistentFields (MonoBehaviour obj) |
|
bool | HasScenePersistentFields (MonoBehaviour obj) |
|
Dictionary< string, Dictionary< string, DataEntry > > | CreateDataDictionary (List< DataEntry > dataEntries) |
| Creates a nested dictionary of data entries for quick access.
|
|
DataEntry | GetDataEntry (Dictionary< string, Dictionary< string, DataEntry > > dataDict, string className, string fieldName) |
| Retrieves a data entry from a nested dictionary.
|
|
byte[] | Encrypt (string plainText, string password) |
| Encrypts a plain text string with AES and returns the byte array.
|
|
string | Decrypt (byte[] cipherData, string password) |
| Decrypts an AES-encrypted byte array and returns the plain text.
|
|
byte[] | DeriveKey (string password, byte[] salt, int keyBytes) |
| Derives a key from a password and salt using PBKDF2.
|
|
byte[] | GenerateRandomBytes (int count) |
| Generates a random byte array.
|
|
|
JsonSerializerSettings | jsonSettings |
| Custom settings for JSON serialization.
|
|
Manages persistent game and scene data saving and loading. Uses JSON serialization and optionally AES encryption.
◆ ApplyData()
void Backbone::PersistenceManager::ApplyData |
( |
| ) |
|
|
private |
Applies the loaded data to scene objects.
◆ ApplyEntriesToObjects()
bool Backbone::PersistenceManager::ApplyEntriesToObjects |
( |
List< DataEntry > | entries, |
|
|
bool | isSceneData ) |
|
private |
◆ Awake()
void Backbone::PersistenceManager::Awake |
( |
| ) |
|
|
private |
Initializes the system, setting up the Singleton and JSON serializer.
◆ CollectData()
void Backbone::PersistenceManager::CollectData |
( |
| ) |
|
|
private |
Collects data marked with persistent attributes and stores them in gameData or sceneData, updating only the current scene and preserving the rest.
◆ CreateDataDictionary()
Dictionary< string, Dictionary< string, DataEntry > > Backbone::PersistenceManager::CreateDataDictionary |
( |
List< DataEntry > | dataEntries | ) |
|
|
private |
Creates a nested dictionary of data entries for quick access.
◆ Decrypt()
string Backbone::PersistenceManager::Decrypt |
( |
byte[] | cipherData, |
|
|
string | password ) |
|
private |
Decrypts an AES-encrypted byte array and returns the plain text.
◆ DeriveKey()
byte[] Backbone::PersistenceManager::DeriveKey |
( |
string | password, |
|
|
byte[] | salt, |
|
|
int | keyBytes ) |
|
private |
Derives a key from a password and salt using PBKDF2.
◆ Encrypt()
byte[] Backbone::PersistenceManager::Encrypt |
( |
string | plainText, |
|
|
string | password ) |
|
private |
Encrypts a plain text string with AES and returns the byte array.
◆ GenerateRandomBytes()
byte[] Backbone::PersistenceManager::GenerateRandomBytes |
( |
int | count | ) |
|
|
private |
Generates a random byte array.
◆ GetAvailableSaveSlots()
List< int > Backbone::PersistenceManager::GetAvailableSaveSlots |
( |
| ) |
|
Scans the persistent data path for existing save files and returns a list of available save slot numbers (e.g., 0, 1, 2).
- Returns
- A sorted list of integers representing the slot numbers of existing save files.
◆ GetDataEntry()
DataEntry Backbone::PersistenceManager::GetDataEntry |
( |
Dictionary< string, Dictionary< string, DataEntry > > | dataDict, |
|
|
string | className, |
|
|
string | fieldName ) |
|
private |
Retrieves a data entry from a nested dictionary.
◆ GetFullHierarchyPath()
static string Backbone::PersistenceManager::GetFullHierarchyPath |
( |
Transform | transform | ) |
|
|
staticprivate |
◆ HasGamePersistentFields()
bool Backbone::PersistenceManager::HasGamePersistentFields |
( |
MonoBehaviour | obj | ) |
|
|
private |
◆ HasScenePersistentFields()
bool Backbone::PersistenceManager::HasScenePersistentFields |
( |
MonoBehaviour | obj | ) |
|
|
private |
◆ Load()
void Backbone::PersistenceManager::Load |
( |
int | slot = 0 | ) |
|
Loads the saved state from a slot.
- Parameters
-
◆ Save()
void Backbone::PersistenceManager::Save |
( |
int | slot = 0 | ) |
|
Saves the current game and scene state to a file.
- Parameters
-
◆ gameData
GameData Backbone::PersistenceManager::gameData |
◆ Instance
◆ jsonSettings
JsonSerializerSettings Backbone::PersistenceManager::jsonSettings |
|
private |
Custom settings for JSON serialization.
◆ password
string Backbone::PersistenceManager::password = "" |
Password used for encrypting/decrypting data.
◆ sceneData
SceneData Backbone::PersistenceManager::sceneData |
The documentation for this class was generated from the following file: