存储功能更新

This commit is contained in:
2025-03-25 23:14:01 +08:00
parent cbe042fec1
commit 7f5c17dff8
16 changed files with 209 additions and 651 deletions
+31 -1
View File
@@ -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