Files

93 lines
1.8 KiB
C#
Raw Permalink Normal View History

2023-06-20 13:17:31 -05:00
using System;
namespace SmartPoint.Components
{
public abstract class PlayerPrefsProvider<T> where T : new()
{
2023-07-01 21:07:29 -05:00
public string Key
2023-06-20 13:17:31 -05:00
{
2023-07-01 21:07:29 -05:00
get
{
return typeof(T).FullName;
}
2023-06-20 13:17:31 -05:00
}
2023-07-01 21:07:29 -05:00
private static T instance;
2023-06-20 13:17:31 -05:00
public static T Instance
{
get
{
2023-07-01 21:07:29 -05:00
if (instance == null)
2023-06-20 13:17:31 -05:00
{
2023-07-01 21:07:29 -05:00
instance = Activator.CreateInstance<T>();
2023-06-20 13:17:31 -05:00
}
2023-07-01 21:07:29 -05:00
return instance;
2023-06-20 13:17:31 -05:00
}
}
2023-07-01 21:07:29 -05:00
public void Initialization()
{
return;
}
public bool CustomLoadOperation()
{
return false;
}
public bool CustomSaveOperation()
{
return false;
}
public bool CustomLoadAsyncOperation()
{
//ulong result = CustomLoadOperation(); // Assuming CustomLoadOperation returns a ulong
//if ((result & 1) != 0) // Check if the least significant bit is set
//{
//OnPostLoad(); // Assuming OnPostLoad is a method of this class
//return true;
//}
return false;
}
public void CustomSaveAsyncOperation()
{
//function1?.Invoke();
//function2?.Invoke();
}
public void OnPostLoad()
{
return;
}
public void OnPreSave()
{
return;
}
2023-06-20 13:17:31 -05:00
public static void Load(bool forceReload = false, bool isAsync = false)
{
}
public static void Save(bool isAsync = false)
{
}
public static void Clear()
{
}
protected PlayerPrefsProvider()
{
}
private bool _loaded;
private static T _instance;
}
}