Show / Hide Table of Contents

Class SaveLoadManager

Implements save/load logic. Games are saved in PersistentDataPath\Saves. Each save game will have a screenshot and multiple files.

Inheritance
Object
Object
Component
Behaviour
MonoBehaviour
SaveLoadManager
Namespace: DaggerfallWorkshop.Game.Serialization
Assembly: Assembly-CSharp.dll
Syntax
public class SaveLoadManager : MonoBehaviour

Properties

| Improve this Doc View Source

CharacterCount

Declaration
public int CharacterCount { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

CharacterNames

Declaration
public string[] CharacterNames { get; }
Property Value
Type Description
String[]
| Improve this Doc View Source

DaggerfallSavePath

Declaration
public string DaggerfallSavePath { get; }
Property Value
Type Description
String
| Improve this Doc View Source

HasInstance

Declaration
public static bool HasInstance { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

Instance

Declaration
public static SaveLoadManager Instance { get; }
Property Value
Type Description
SaveLoadManager
| Improve this Doc View Source

IsSavingPrevented

Declaration
public bool IsSavingPrevented { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

LatestSaveVersion

Declaration
public int LatestSaveVersion { get; }
Property Value
Type Description
Int32
| Improve this Doc View Source

LoadInProgress

Declaration
public bool LoadInProgress { get; }
Property Value
Type Description
Boolean
| Improve this Doc View Source

StateManager

Declaration
public static SerializableStateManager StateManager { get; }
Property Value
Type Description
SerializableStateManager
| Improve this Doc View Source

UnitySavePath

Declaration
public string UnitySavePath { get; }
Property Value
Type Description
String

Methods

| Improve this Doc View Source

CacheScene(String)

Stores the current scene in the SerializableStateManager cache using the given name.

Declaration
public static void CacheScene(string sceneName)
Parameters
Type Name Description
String sceneName
| Improve this Doc View Source

ClearSceneCache(Boolean)

Clears the SerializableStateManager scene cache.

Declaration
public static void ClearSceneCache(bool start)
Parameters
Type Name Description
Boolean start

True if starting a new or loaded game, so also clear permanent scene list

| Improve this Doc View Source

DeleteSaveFolder(Int32)

Deletes save folder.

Declaration
public void DeleteSaveFolder(int key)
Parameters
Type Name Description
Int32 key

Save key.

| Improve this Doc View Source

DeregisterAllSerializableGameObjects(Boolean)

Force deregister all ISerializableGameObject instances from SerializableStateManager.

Declaration
public static void DeregisterAllSerializableGameObjects(bool keepPlayer = true)
Parameters
Type Name Description
Boolean keepPlayer
| Improve this Doc View Source

DeregisterSerializableGameObject(ISerializableGameObject)

Deregister ISerializableGameObject from SerializableStateManager.

Declaration
public static void DeregisterSerializableGameObject(ISerializableGameObject serializableObject)
Parameters
Type Name Description
ISerializableGameObject serializableObject
| Improve this Doc View Source

Deserialize(Type, String)

Declaration
public static object Deserialize(Type type, string serializedState)
Parameters
Type Name Description
Type type
String serializedState
Returns
Type Description
Object
| Improve this Doc View Source

EnumerateSaves()

Updates save game enumerations. Must call this before working with existing saves. For example, this is called in save UI every time window pushed to stack.

Declaration
public void EnumerateSaves()
| Improve this Doc View Source

FindMostRecentSave()

Finds most recent save.

Declaration
public int FindMostRecentSave()
Returns
Type Description
Int32

Save key of most recent save, or -1 if no saves found.

| Improve this Doc View Source

FindSaveFolderByNames(String, String)

Finds existing save folder.

Declaration
public int FindSaveFolderByNames(string characterName, string saveName)
Parameters
Type Name Description
String characterName

Name of character to match.

String saveName

Name of save to match.

Returns
Type Description
Int32

Save key or -1 if save not found.

| Improve this Doc View Source

FindSingleton(out SaveLoadManager)

Declaration
public static bool FindSingleton(out SaveLoadManager singletonOut)
Parameters
Type Name Description
SaveLoadManager singletonOut
Returns
Type Description
Boolean
| Improve this Doc View Source

GetCharacterNames()

Declaration
public string[] GetCharacterNames()
Returns
Type Description
String[]
| Improve this Doc View Source

GetCharacterSaveKeys(String)

Gets array of save keys for the specified character.

Declaration
public int[] GetCharacterSaveKeys(string characterName)
Parameters
Type Name Description
String characterName

Name of character.

Returns
Type Description
Int32[]

Array of save keys

| Improve this Doc View Source

GetSaveFolder(Int32)

Gets folder containing save by key.

Declaration
public string GetSaveFolder(int key)
Parameters
Type Name Description
Int32 key

Save key.

Returns
Type Description
String

Path to save folder or empty string if key not found.

| Improve this Doc View Source

GetSaveInfo(Int32)

Gets save information by key.

Declaration
public SaveInfo_v1 GetSaveInfo(int key)
Parameters
Type Name Description
Int32 key

Save key.

Returns
Type Description
SaveInfo_v1

SaveInfo populated with save details, or empty struct if save not found.

| Improve this Doc View Source

GetSaveScreenshot(Int32)

Declaration
public Texture2D GetSaveScreenshot(int key)
Parameters
Type Name Description
Int32 key
Returns
Type Description
Texture2D
| Improve this Doc View Source

HasQuickSave(String)

Checks if quick save folder exists.

Declaration
public bool HasQuickSave(string characterName)
Parameters
Type Name Description
String characterName
Returns
Type Description
Boolean

True if quick save exists.

| Improve this Doc View Source

IsReady()

Checks if save/load system is ready.

Declaration
public bool IsReady()
Returns
Type Description
Boolean

True if ready.

| Improve this Doc View Source

Load(Int32)

Declaration
public void Load(int key)
Parameters
Type Name Description
Int32 key
| Improve this Doc View Source

Load(String, String)

Declaration
public void Load(string characterName, string saveName)
Parameters
Type Name Description
String characterName
String saveName
| Improve this Doc View Source

PromptLoadGame(String, String, Action)

Checks for a mod mismatch in a save, and displays a warning message before proceeding

Declaration
public void PromptLoadGame(string characterName, string saveName, Action loadGameAction)
Parameters
Type Name Description
String characterName

Character's name in the save

String saveName

Name of the save to be loaded

Action loadGameAction

The steps taken to load a save after finding no mismatches, or after user proceeds to load anyway

| Improve this Doc View Source

PromptQuickLoadGame(String, Action)

Checks for a mod mismatch in the QuickSave, and displays a warning message before proceeding

Declaration
public void PromptQuickLoadGame(string characterName, Action loadGameAction)
Parameters
Type Name Description
String characterName

Character's name in the save

Action loadGameAction

The steps taken to load a save after finding no mismatches, or after user proceeds to load anyway

| Improve this Doc View Source

QuickLoad()

Declaration
public void QuickLoad()
| Improve this Doc View Source

QuickSave(Boolean)

Declaration
public void QuickSave(bool instantReload = false)
Parameters
Type Name Description
Boolean instantReload
| Improve this Doc View Source

RaiseOnLoadEvent(SaveData_v1)

Declaration
protected virtual void RaiseOnLoadEvent(SaveData_v1 saveData)
Parameters
Type Name Description
SaveData_v1 saveData
| Improve this Doc View Source

RaiseOnSaveEvent(SaveData_v1)

Declaration
protected virtual void RaiseOnSaveEvent(SaveData_v1 saveData)
Parameters
Type Name Description
SaveData_v1 saveData
| Improve this Doc View Source

RaiseOnStartLoadEvent(SaveData_v1)

Declaration
protected virtual void RaiseOnStartLoadEvent(SaveData_v1 saveData)
Parameters
Type Name Description
SaveData_v1 saveData
| Improve this Doc View Source

RegisterPreventSaveCondition(Func<Boolean>)

Declaration
public void RegisterPreventSaveCondition(Func<bool> handler)
Parameters
Type Name Description
Func<Boolean> handler
| Improve this Doc View Source

RegisterSerializableGameObject(ISerializableGameObject)

Register ISerializableGameObject with SerializableStateManager.

Declaration
public static void RegisterSerializableGameObject(ISerializableGameObject serializableObject)
Parameters
Type Name Description
ISerializableGameObject serializableObject
| Improve this Doc View Source

Rename(Int32, String)

Declaration
public void Rename(int key, string newSaveName)
Parameters
Type Name Description
Int32 key
String newSaveName
| Improve this Doc View Source

RestoreCachedScene(String)

Restores the current scene from the SerializableStateManager cache using the given name.

Declaration
public static void RestoreCachedScene(string sceneName)
Parameters
Type Name Description
String sceneName
| Improve this Doc View Source

Save(String, String, Boolean)

Declaration
public void Save(string characterName, string saveName, bool instantReload = false)
Parameters
Type Name Description
String characterName
String saveName
Boolean instantReload
| Improve this Doc View Source

Serialize(Type, Object, Boolean)

Declaration
public static string Serialize(Type type, object value, bool pretty = true)
Parameters
Type Name Description
Type type
Object value
Boolean pretty
Returns
Type Description
String
| Improve this Doc View Source

UnregisterPreventSaveCondition(Func<Boolean>)

Declaration
public void UnregisterPreventSaveCondition(Func<bool> handler)
Parameters
Type Name Description
Func<Boolean> handler

Events

| Improve this Doc View Source

OnLoad

Declaration
public static event SaveLoadManager.OnLoadEventHandler OnLoad
Event Type
Type Description
SaveLoadManager.OnLoadEventHandler
| Improve this Doc View Source

OnSave

Declaration
public static event SaveLoadManager.OnSaveEventHandler OnSave
Event Type
Type Description
SaveLoadManager.OnSaveEventHandler
| Improve this Doc View Source

OnStartLoad

Declaration
public static event SaveLoadManager.OnStartLoadEventHandler OnStartLoad
Event Type
Type Description
SaveLoadManager.OnStartLoadEventHandler

Extension Methods

MBExtensions.Invoke(MonoBehaviour, Action, Single)
MBExtensions.Invoke<T>(MonoBehaviour, Action<T>, T, Single)
MBExtensions.Invoke<T1, T2>(MonoBehaviour, Action<T1, T2>, T1, T2, Single)
MBExtensions.Invoke<T1, T2, T3>(MonoBehaviour, Action<T1, T2, T3>, T1, T2, T3, Single)
MBExtensions.Invoke<T1, T2, T3, T4>(MonoBehaviour, Action<T1, T2, T3, T4>, T1, T2, T3, T4, Single)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX