diff --git a/Assets/Scripts/Game Loop/ChapterController.cs b/Assets/Scripts/Game Loop/ChapterController.cs index 059b3e7cd..c0df6417e 100644 --- a/Assets/Scripts/Game Loop/ChapterController.cs +++ b/Assets/Scripts/Game Loop/ChapterController.cs @@ -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)