fix(game-loop): 修复存档章节名解析逻辑
This commit is contained in:
@@ -45,8 +45,19 @@ namespace AibisDream
|
||||
|
||||
private static string ParseChapterTitle(string filePath)
|
||||
{
|
||||
var fileInfo = Path.GetFileName(filePath).Split("_");
|
||||
return fileInfo.Length >= 2 ? fileInfo[1] : string.Empty;
|
||||
var fileName = Path.GetFileNameWithoutExtension(filePath);
|
||||
var parts = fileName.Split('_');
|
||||
// 文件名格式: yyyyMMdd-HHmmss_{sceneSoName}_{gameStage}
|
||||
// sceneSoName 可能包含下划线,但时间戳(第0段)和游戏阶段(最后1段)不会
|
||||
if (parts.Length < 3)
|
||||
{
|
||||
Debug.LogWarning($"存档文件名格式异常: {fileName}");
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
var sceneSoName = string.Join("_", parts, 1, parts.Length - 2);
|
||||
Debug.Log($"ParseChapterTitle: 从 {fileName} 解析出章节名 = {sceneSoName}");
|
||||
return sceneSoName;
|
||||
}
|
||||
|
||||
public void StartWithChapter(ChapterVo chapterVo)
|
||||
|
||||
Reference in New Issue
Block a user