存档读档功能
This commit is contained in:
@@ -41,7 +41,7 @@ namespace AibisDream
|
||||
{
|
||||
MainUIController.Instance.TVFadeOut(1);
|
||||
GameObject.Find("Menu Canvas").SetActive(false);
|
||||
StartCoroutine(LoadSaveFile(saveFileName));
|
||||
StartCoroutine(LoadSaveFile($"{TestSaveFilePath}/{saveFileName}"));
|
||||
}
|
||||
#else
|
||||
runMode = RunMode.Product;
|
||||
@@ -86,6 +86,7 @@ namespace AibisDream
|
||||
#region 存档相关
|
||||
|
||||
private static readonly string SaveFilePath = Application.streamingAssetsPath + "/SaveFiles";
|
||||
private static readonly string TestSaveFilePath = Application.streamingAssetsPath + "/TestSaveFiles";
|
||||
|
||||
// 维修系统相关数据
|
||||
public static readonly DataContainer FixDataContainer = new();
|
||||
@@ -125,9 +126,9 @@ namespace AibisDream
|
||||
_fixStateArgs = curArgs;
|
||||
}
|
||||
|
||||
private IEnumerator LoadSaveFile(string saveName)
|
||||
private IEnumerator LoadSaveFile(string savePath)
|
||||
{
|
||||
var saveFile = JsonUtil.ReadJObject($"{SaveFilePath}/{saveName}");
|
||||
var saveFile = JsonUtil.ReadJObject(savePath);
|
||||
// 先加载对话数据
|
||||
var floatDict = saveFile["floatDict"]?.ToObject<Dictionary<string, float>>();
|
||||
var stringDict = saveFile["stringDict"]?.ToObject<Dictionary<string, string>>();
|
||||
@@ -150,10 +151,10 @@ namespace AibisDream
|
||||
// 初始化维修状态机
|
||||
_fixState = saveFile["fixState"]!.ToObject<FixState>();
|
||||
_fixStateArgs = saveFile["fixStateArgs"]!.ToString();
|
||||
FixSystemCenter.StateMachine.SwitchState(_fixState, _fixStateArgs);
|
||||
yield return FixSystemCenter.StateMachine.SwitchState(_fixState, _fixStateArgs);
|
||||
|
||||
// 开启对话
|
||||
DialogController.Instance.StartDialog(_currentTalkSceneSo.yarnProject);
|
||||
DialogController.Instance.LoadDialog(_currentTalkSceneSo.yarnProject);
|
||||
}
|
||||
|
||||
public void Save()
|
||||
@@ -197,4 +198,13 @@ namespace AibisDream
|
||||
SingleScene,
|
||||
SaveFile
|
||||
}
|
||||
|
||||
public static class GameLoopYarnCommand
|
||||
{
|
||||
[YarnCommand("auto_save")]
|
||||
public static void AutoSave()
|
||||
{
|
||||
GameLoopManager.Instance.Save();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user