diff --git a/Assets/Scripts/DataPersistence/Data/InventoryData.cs b/Assets/Scripts/DataPersistence/Data/InventoryData.cs index 4265fd7..2465fa0 100644 --- a/Assets/Scripts/DataPersistence/Data/InventoryData.cs +++ b/Assets/Scripts/DataPersistence/Data/InventoryData.cs @@ -6,6 +6,6 @@ using UnityEngine; public class InventoryData { public int capacity = 0; - + public SerializableDictionary items = new SerializableDictionary(); } diff --git a/Assets/Scripts/DataPersistence/DataPersistenceManager.cs b/Assets/Scripts/DataPersistence/DataPersistenceManager.cs index 5594a66..bce1e6f 100644 --- a/Assets/Scripts/DataPersistence/DataPersistenceManager.cs +++ b/Assets/Scripts/DataPersistence/DataPersistenceManager.cs @@ -1,7 +1,7 @@ using System.Collections; using System.Collections.Generic; -using UnityEngine; using System.Linq; +using UnityEngine; using UnityEngine.SceneManagement; public class DataPersistenceManager : MonoBehaviour @@ -10,11 +10,15 @@ public class DataPersistenceManager : MonoBehaviour // [SerializeField] private bool initializeDataIfNull = false; [Header("File Storage Config")] - [SerializeField] private string fileName; - [SerializeField] private bool useEncryption; + [SerializeField] + private string fileName; + + [SerializeField] + private bool useEncryption; [Header("Auto Saving Configuration")] - [SerializeField] private float autoSaveTimeSeconds = 60f; + [SerializeField] + private float autoSaveTimeSeconds = 60f; private GameData gameData = new GameData(); private List> dataPersistenceObjects; @@ -28,14 +32,20 @@ public class DataPersistenceManager : MonoBehaviour { if (instance != null) { - Debug.Log("Found more than one Data Persistence Manager in the scene. Destroying the newest one."); + Debug.Log( + "Found more than one Data Persistence Manager in the scene. Destroying the newest one." + ); Destroy(this.gameObject); return; } instance = this; DontDestroyOnLoad(this.gameObject); - this.dataHandler = new FileDataHandler(Application.persistentDataPath, fileName, useEncryption); + this.dataHandler = new FileDataHandler( + Application.persistentDataPath, + fileName, + useEncryption + ); } private void OnEnable() @@ -90,7 +100,7 @@ public class DataPersistenceManager : MonoBehaviour } // if no data can be loaded, don't continue - // if (this.gameData == null) + // if (this.gameData == null) // { // Debug.Log("No data was found. A New Game needs to be started before data can be loaded."); // return; @@ -112,7 +122,9 @@ public class DataPersistenceManager : MonoBehaviour // if we don't have any data to save, log a warning here if (this.gameData == null) { - Debug.LogWarning("No data was found. A New Game needs to be started before data can be saved."); + Debug.LogWarning( + "No data was found. A New Game needs to be started before data can be saved." + ); return; } @@ -137,8 +149,9 @@ public class DataPersistenceManager : MonoBehaviour private List> FindAllDataPersistenceObjects() { // FindObjectsofType takes in an optional boolean to include inactive gameobjects - IEnumerable> dataPersistenceObjects = FindObjectsByType(FindObjectsSortMode.None) - .OfType>(); + IEnumerable> dataPersistenceObjects = + FindObjectsByType(FindObjectsSortMode.None) + .OfType>(); var list = new List>(dataPersistenceObjects); return list;