Copied the 89 uncopied AI*SimulationUtility/extension files defining the AIVirtualCard/AIVirtualField extension methods; the compile loop then auto-closed the revealed type deps (~3049 files total, drift-clean). 10.0k -> 62 errors.
64 lines
1.3 KiB
C#
64 lines
1.3 KiB
C#
using System.Collections.Generic;
|
|
|
|
namespace Wizard;
|
|
|
|
public class PlayerPrefsCache
|
|
{
|
|
private Dictionary<string, bool> _boolCache = new Dictionary<string, bool>();
|
|
|
|
private Dictionary<string, int> _intCache = new Dictionary<string, int>();
|
|
|
|
private static PlayerPrefsCache _instance;
|
|
|
|
public static PlayerPrefsCache Instance
|
|
{
|
|
get
|
|
{
|
|
if (_instance == null)
|
|
{
|
|
_instance = new PlayerPrefsCache();
|
|
}
|
|
return _instance;
|
|
}
|
|
}
|
|
|
|
public static void OnSoftwareReset()
|
|
{
|
|
_instance = null;
|
|
}
|
|
|
|
public int GetValue(KeyValuePair<string, int> id)
|
|
{
|
|
if (_intCache.TryGetValue(id.Key, out var value))
|
|
{
|
|
return value;
|
|
}
|
|
value = PlayerPrefsWrapper.GetValue(id);
|
|
_intCache.Add(id.Key, value);
|
|
return value;
|
|
}
|
|
|
|
public void SetValue(KeyValuePair<string, int> id, int value)
|
|
{
|
|
PlayerPrefsWrapper.SetValue(id, value);
|
|
_intCache[id.Key] = value;
|
|
}
|
|
|
|
public bool GetBool(KeyValuePair<string, int> id)
|
|
{
|
|
if (_boolCache.TryGetValue(id.Key, out var value))
|
|
{
|
|
return value;
|
|
}
|
|
value = PlayerPrefsWrapper.GetBool(id);
|
|
_boolCache.Add(id.Key, value);
|
|
return value;
|
|
}
|
|
|
|
public void SetBool(KeyValuePair<string, int> id, bool value)
|
|
{
|
|
PlayerPrefsWrapper.SetBool(id, value);
|
|
_boolCache[id.Key] = value;
|
|
}
|
|
}
|