linting fixes

This commit is contained in:
Aggtaa 2026-01-11 13:52:25 +03:00
parent f846df9d8c
commit 603b2d3469
2 changed files with 24 additions and 11 deletions

View File

@ -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()
@ -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,7 +149,8 @@ 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)
IEnumerable<IDataPersistence<GameData>> dataPersistenceObjects =
FindObjectsByType<MonoBehaviour>(FindObjectsSortMode.None)
.OfType<IDataPersistence<GameData>>();
var list = new List<IDataPersistence<GameData>>(dataPersistenceObjects);