12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455 |
- using UnityEngine;
- namespace SC.XR.Unity.Module_PlatformAccount
- {
- public abstract class LitJsonMgr
- {
- private static LitJsonMgr instance;
- public static LitJsonMgr Instance
- {
- get
- {
- if (instance != null)
- {
- return instance;
- }
- else
- {
- instance = new LitJsonManager();
- }
- return instance;
- }
- }
- /// <summary>
- /// Json保存目录
- /// </summary>
- public string DirectoryPath { get { return Application.persistentDataPath + "/PlatformAccount/"; } }
- /// <summary>
- /// 初始化Json
- /// </summary>
- public abstract void Init<T>(string key, T t) where T : new();
- /// <summary>
- /// 读取Json
- /// </summary>
- public abstract T ReadJson<T>(string key, ref T t) where T : new();
- /// <summary>
- /// 写入Json
- /// </summary>
- public virtual void WriteJson<T>(string key, T t) where T : new()
- {
- Save();
- }
- /// <summary>
- /// 保存数据
- /// </summary>
- public virtual void Save() { }
- }
- }
|