A static class for saving and loading game data using the Dialogue System's Lua environment. More...
Classes | |
class | AsyncRawDataOperation |
class | AsyncSaveOperation |
Public Types | |
enum | RecordPersistentDataOn { AllGameObjects , OnlyRegisteredGameObjects , NoGameObjects } |
Static Public Member Functions | |
static void | RegisterPersistentData (GameObject go) |
static void | UnregisterPersistentData (GameObject go) |
static void | Reset (DatabaseResetOptions databaseResetOptions) |
Resets the Lua environment – for example, when starting a new game. | |
static void | Reset () |
Resets the Lua environment – for example, when starting a new game – keeping all loaded database in memory and just resetting them. | |
static void | Record () |
Sends the OnRecordPersistentData message to all GameObjects in the scene to give them an opportunity to record their state in the Lua environment. | |
static void | Apply () |
Sends the OnApplyPersistentData message to all game objects in the scene to give them an opportunity to retrieve their state from the Lua environment. | |
static void | LevelWillBeUnloaded () |
Sends the OnLevelWillBeUnloaded message to all game objects in the scene in case they need to change their behavior. | |
static void | ApplySaveData (string saveData, DatabaseResetOptions databaseResetOptions=DatabaseResetOptions.KeepAllLoaded) |
Loads a saved game by applying a saved-game string. | |
static void | ApplyLuaInternal (string saveData, bool allowExceptions=false) |
Loads data into the Lua environment. | |
static string | GetSaveData () |
Saves a game by retrieving the Lua environment and returning it as a saved-game string. | |
static void | AppendDialogueSystemData (StringBuilder sb) |
static void | AppendVariableData (StringBuilder sb) |
Appends the user variable table to a (saved-game) string. | |
static void | AppendItemData (StringBuilder sb) |
Appends the item table to a (saved-game) string. | |
static void | AppendLocationData (StringBuilder sb) |
Appends the location table to a (saved-game) string. | |
static void | AppendActorData (StringBuilder sb) |
Appends the actor table to a (saved-game) string. | |
static void | AppendRelationshipAndStatusTables (StringBuilder sb) |
Appends the relationship and status tables to a (saved-game) string. | |
static void | RefreshRelationshipAndStatusTablesFromLua () |
Instructs the Dialogue System to refresh its internal relationship and status tables from the values in the Lua environment. | |
static void | AppendConversationData (StringBuilder sb) |
Appends the conversation table to a (saved-game) string. | |
static void | AppendSimStatus (StringBuilder sb) |
Appends SimStatus for all conversations. | |
static void | ExpandCompressedSimStatusData () |
When reapplying saved data, expands compress SimX info into conversations' SimStatus tables. | |
static void | InitializeNewVariablesFromDatabase () |
Instructs the Dialogue System to add any missing variables that are in the master database but not in Lua. | |
static void | InitializeNewActorFieldsFromDatabase () |
Adds any new actors or actor fields that were not in the saved data. | |
static void | InitializeNewQuestEntriesFromDatabase () |
Instructs the Dialogue System to add any missing quests and entries that are in the master database but not in Lua. | |
static void | InitializeNewSimStatusFromDatabase () |
Initializes SimStatus for entries that were added to the database after the saved game. | |
static AsyncSaveOperation | GetSaveDataAsync () |
static void | RecordAsync () |
Sends the OnRecordPersistentData message to all game objects in the scene to give them an opportunity to record their state in the Lua environment. | |
static byte[] | GetRawData () |
static AsyncRawDataOperation | GetRawDataAsync () |
static void | ApplyRawData (byte[] bytes) |
Static Public Attributes | |
static bool | includeActorData = true |
Set true to include actor data in save data, false to exclude. | |
static bool | includeAllItemData = false |
Set this true to include all item fields in saved-game data. | |
static bool | includeLocationData = false |
Set true to include location data in save data, false to exclude. | |
static bool | includeAllConversationFields = false |
Set true to include all conversation fields, false to exclude. | |
static bool | includeSimStatus = false |
Set this true to exclude Conversation[#].Dialog[#].SimStatus values from saved-game data. | |
static string | saveConversationSimStatusWithField = string.Empty |
Optional field to use when saving a conversation's SimStatus info (e.g., Title). | |
static string | saveDialogueEntrySimStatusWithField = string.Empty |
Optional field to use when saving a dialogue entry's SimStatus info (e.g,. | |
static bool | includeRelationshipAndStatusData = true |
Set true to include the status & relationship tables in save data, false to exclude. | |
static bool | initializeNewVariables = true |
Initialize variables and quests that were added to database after saved game. | |
static bool | initializeNewSimStatus = true |
Initialize new SimStatus values for entries that were added to database after saved game. | |
static GetCustomSaveDataDelegate | GetCustomSaveData = null |
PersistentDataManager will call this delegate (if set) to add custom data to the saved-game data string. | |
static RecordPersistentDataOn | recordPersistentDataOn = RecordPersistentDataOn.AllGameObjects |
static int | asyncGameObjectBatchSize = 1000 |
static int | asyncDialogueEntryBatchSize = 100 |
A static class for saving and loading game data using the Dialogue System's Lua environment.
It allows you to save or load a game with a single line of code.
For more information, see saveLoadSystem
|
inlinestatic |
Appends the actor table to a (saved-game) string.
|
inlinestatic |
Appends the conversation table to a (saved-game) string.
To conserve space, only the SimStatus is recorded. If includeSimStatus is false
, nothing is recorded. The exception is if includeAllConversationFields is true.
|
inlinestatic |
|
inlinestatic |
Appends the item table to a (saved-game) string.
|
inlinestatic |
Appends the location table to a (saved-game) string.
Currently doesn't save anything unless includeLocationData is true.
|
inlinestatic |
Appends the relationship and status tables to a (saved-game) string.
sb | StringBuilder to append to. |
|
inlinestatic |
Appends SimStatus for all conversations.
|
inlinestatic |
Appends the user variable table to a (saved-game) string.
|
inlinestatic |
Sends the OnApplyPersistentData message to all game objects in the scene to give them an opportunity to retrieve their state from the Lua environment.
If calling this after loading a new scene, you may want to wait one frame to allow other GameObject's Start methods to complete first. You can limit which GameObjects receive messages by changing recordPersistentDataOn.
|
inlinestatic |
Loads data into the Lua environment.
saveData | |
allowExceptions |
|
inlinestatic |
|
inlinestatic |
Loads a saved game by applying a saved-game string.
saveData | A saved-game string previously returned by GetSaveData(). |
databaseResetOptions | Database reset options. |
|
inlinestatic |
When reapplying saved data, expands compress SimX info into conversations' SimStatus tables.
|
inlinestatic |
|
inlinestatic |
|
inlinestatic |
Saves a game by retrieving the Lua environment and returning it as a saved-game string.
This method calls Record() to allow all game objects in the scene to record their state to the Lua environment first. The returned string is human-readable Lua code.
To reduce saved-game data size, only the following information is recorded from the Chat Mapper tables (Item[], Actor[], etc):
Actor[]
: all dataItem[]
: only State
(for quest log system)Location[]
: nothingVariable[]
: current value of each variableConversation[]
: SimStatus
|
inlinestatic |
|
inlinestatic |
Adds any new actors or actor fields that were not in the saved data.
|
inlinestatic |
Instructs the Dialogue System to add any missing quests and entries that are in the master database but not in Lua.
|
inlinestatic |
Initializes SimStatus for entries that were added to the database after the saved game.
|
inlinestatic |
Instructs the Dialogue System to add any missing variables that are in the master database but not in Lua.
|
inlinestatic |
Sends the OnLevelWillBeUnloaded message to all game objects in the scene in case they need to change their behavior.
For example, scripts that do something special when destroyed during play may not want to do the same thing when being destroyed by a level unload.
|
inlinestatic |
Sends the OnRecordPersistentData message to all GameObjects in the scene to give them an opportunity to record their state in the Lua environment.
You can limit which GameObjects receive messages by changing recordPersistentDataOn.
|
inlinestatic |
Sends the OnRecordPersistentData message to all game objects in the scene to give them an opportunity to record their state in the Lua environment.
Runs in batches specified by the value of asyncGameObjectBatchSize.
|
inlinestatic |
Instructs the Dialogue System to refresh its internal relationship and status tables from the values in the Lua environment.
Call this after putting new values in the Lua environment, such as when loading a saved game.
|
inlinestatic |
go | GameObject that should receive notifications. |
|
inlinestatic |
Resets the Lua environment – for example, when starting a new game – keeping all loaded database in memory and just resetting them.
|
inlinestatic |
Resets the Lua environment – for example, when starting a new game.
databaseResetOptions | The database reset options can be: |
|
inlinestatic |
go | GameObject that should no longer receive notifications. |
|
static |
|
static |
|
static |
PersistentDataManager will call this delegate (if set) to add custom data to the saved-game data string.
The custom data should be valid Lua code.
|
static |
Set true
to include actor data in save data, false
to exclude.
|
static |
Set true
to include all conversation fields, false
to exclude.
|
static |
Set this true
to include all item fields in saved-game data.
This is false
by default to minimize the size of the saved-game data by only recording State and Track (for quests).
|
static |
Set true
to include location data in save data, false
to exclude.
|
static |
Set true
to include the status & relationship tables in save data, false
to exclude.
|
static |
Set this true
to exclude Conversation[#].Dialog[#].SimStatus values from saved-game data.
If you don't use SimStatus in your Lua conditions, there's no need to save it.
|
static |
Initialize new SimStatus values for entries that were added to database after saved game.
|
static |
Initialize variables and quests that were added to database after saved game.
")]
|
static |
|
static |
Optional field to use when saving a conversation's SimStatus info (e.g., Title).
This feature is handy if you can't guarantee that conversation IDs will be the same across saved games. If set, saves the conversation's SimStatus info into a field. If blank, uses conversation ID.
|
static |
Optional field to use when saving a dialogue entry's SimStatus info (e.g,.
Title). This feature is handy if you can't guarantee that dialogue entry IDs will be the same across saved games. If set, saves the entry's SimStatus value into a field. If blank, uses entry's ID.