linting fixes
This commit is contained in:
parent
f846df9d8c
commit
603b2d3469
|
|
@ -6,6 +6,6 @@ using UnityEngine;
|
|||
public class InventoryData
|
||||
{
|
||||
public int capacity = 0;
|
||||
|
||||
|
||||
public SerializableDictionary<string, int> items = new SerializableDictionary<string, int>();
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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<IDataPersistence<GameData>> 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<IDataPersistence<GameData>> FindAllDataPersistenceObjects()
|
||||
{
|
||||
// FindObjectsofType takes in an optional boolean to include inactive gameobjects
|
||||
IEnumerable<IDataPersistence<GameData>> dataPersistenceObjects = FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None)
|
||||
.OfType<IDataPersistence<GameData>>();
|
||||
IEnumerable<IDataPersistence<GameData>> dataPersistenceObjects =
|
||||
FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None)
|
||||
.OfType<IDataPersistence<GameData>>();
|
||||
|
||||
var list = new List<IDataPersistence<GameData>>(dataPersistenceObjects);
|
||||
return list;
|
||||
|
|
|
|||
Loading…
Reference in New Issue