From aa926afa29c58227a6783ab41910b6cb3e97eda2 Mon Sep 17 00:00:00 2001 From: Ding Yuntian <1491671119@qq.com> Date: Thu, 30 Apr 2026 14:41:59 +0800 Subject: [PATCH] =?UTF-8?q?fix(game-loop):=20=E4=BF=AE=E5=A4=8D=E5=AD=98?= =?UTF-8?q?=E6=A1=A3=E7=AB=A0=E8=8A=82=E5=90=8D=E8=A7=A3=E6=9E=90=E9=80=BB?= =?UTF-8?q?=E8=BE=91?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Assets/Scripts/Game Loop/ChapterController.cs | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) 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)