Added new Game logic library to assist with game projects
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
namespace OmegaLeo.HelperLib.Game.Providers
|
||||
{
|
||||
#if UNITY_EDITOR || UNITY_STANDALONE
|
||||
using System.IO;
|
||||
using UnityEngine;
|
||||
|
||||
namespace OmegaLeo.HelperLib.SaveSystem
|
||||
{
|
||||
public class UnitySaveFileProvider : ISaveFileProvider
|
||||
{
|
||||
private readonly string _saveFolder;
|
||||
|
||||
public UnitySaveFileProvider(string saveFolder = "Saves")
|
||||
{
|
||||
_saveFolder = saveFolder;
|
||||
}
|
||||
|
||||
public string GetSaveDirectory()
|
||||
{
|
||||
return Path.Combine(Application.persistentDataPath, _saveFolder);
|
||||
}
|
||||
|
||||
public string GetSavePath(string fileName)
|
||||
{
|
||||
if (!fileName.EndsWith(".json"))
|
||||
fileName += ".json";
|
||||
|
||||
return Path.Combine(GetSaveDirectory(), fileName);
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
}
|
||||
Reference in New Issue
Block a user