存储功能更新
This commit is contained in:
@@ -232,9 +232,23 @@ namespace AibisDream
|
||||
#endif
|
||||
}
|
||||
|
||||
public void Load()
|
||||
public void Load(string savePath)
|
||||
{
|
||||
// 先将存档文件转为JObject
|
||||
var saveData = JsonUtil.ReadJObject(savePath);
|
||||
// 加载Yarn数据
|
||||
var floatDict = saveData["floatDict"]?.ToObject<Dictionary<string, float>>();
|
||||
var stringDict = saveData["stringDict"]?.ToObject<Dictionary<string, string>>();
|
||||
var boolDict = saveData["boolDict"]?.ToObject<Dictionary<string, bool>>();
|
||||
SetAllVariables(floatDict, stringDict, boolDict);
|
||||
|
||||
// 加载系统数据
|
||||
if (saveData["systemData"] is not JObject systemDataJson)
|
||||
{
|
||||
Debug.Log("维修数据读取问题");
|
||||
return;
|
||||
}
|
||||
StartCoroutine(_dataContainer.LoadByJson(systemDataJson));
|
||||
}
|
||||
|
||||
private string GetSavePath()
|
||||
@@ -276,6 +290,22 @@ namespace AibisDream
|
||||
|
||||
return VariableType.Local;
|
||||
}
|
||||
|
||||
#region 单例部分
|
||||
|
||||
public static StorageSystem Instance { get; private set; }
|
||||
|
||||
private void Awake()
|
||||
{
|
||||
if (Instance != null)
|
||||
{
|
||||
Destroy(gameObject);
|
||||
}
|
||||
|
||||
Instance = this;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
|
||||
public enum VariableType
|
||||
|
||||
Reference in New Issue
Block a user