From 3e50d426de555cd5465982d9458f87b09a708ff7 Mon Sep 17 00:00:00 2001
From: Ding Yuntian <1491671119@qq.com>
Date: Thu, 20 Aug 2026 21:01:47 +0800
Subject: [PATCH] =?UTF-8?q?fix:=20=E8=AF=8A=E7=96=97=E8=AE=B0=E5=BD=95?=
=?UTF-8?q?=E5=BC=82=E5=B8=B8=E7=A9=BA=E6=A0=BC=E7=BC=BA=E5=A4=B1?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
Assets/Scripts/Dialog System/LineSyncToken.cs | 7 +++--
.../Framework/AudioKit/AudioManager.cs | 25 ------------------
Assets/Scripts/Game Loop/EventEnums.cs | 26 -------------------
Assets/Scripts/Utility/CommonUtil.cs | 15 +++++++++++
4 files changed, 18 insertions(+), 55 deletions(-)
diff --git a/Assets/Scripts/Dialog System/LineSyncToken.cs b/Assets/Scripts/Dialog System/LineSyncToken.cs
index 06688e311..cbe683d30 100644
--- a/Assets/Scripts/Dialog System/LineSyncToken.cs
+++ b/Assets/Scripts/Dialog System/LineSyncToken.cs
@@ -1,5 +1,4 @@
using System;
-using System.Text.RegularExpressions;
using System.Threading;
using System.Threading.Tasks;
using AibisDream.Framework;
@@ -190,9 +189,9 @@ namespace AibisDream
public string GetRecordLine()
{
- const string allowedTagsPattern = @"(<|{)(?!\/?(b|i|color)(?=>|\s|=))[^(>|})]+(>|})";
- var res = Regex.Replace(lineText, allowedTagsPattern, "");
- return res;
+ var localeKind = LocalizationKit.CurrentLocaleKind;
+ var replaceBrWithSpace = localeKind is not (LocaleKind.Cn or LocaleKind.Ja);
+ return lineText.ToRecordLineText(replaceBrWithSpace);
}
public int CalcAutoDelayTime()
diff --git a/Assets/Scripts/Framework/AudioKit/AudioManager.cs b/Assets/Scripts/Framework/AudioKit/AudioManager.cs
index f05d61633..f6980c030 100644
--- a/Assets/Scripts/Framework/AudioKit/AudioManager.cs
+++ b/Assets/Scripts/Framework/AudioKit/AudioManager.cs
@@ -565,30 +565,5 @@ namespace AibisDream.Kit
RemoveMusic(key);
}
}
-
- public interface IAudioManager
- {
- // Yarn音频接口
- public void PlayMusic(string eventName, string audioKey);
- public void StopMusic(string eventName, STOP_MODE stopMode);
- public void SetMusicParam(string eventName, string paramName, float paramValue);
-
- // AMB参数变化
- public void ChangeAmb(AmbState state);
- public void SetGlobalParam(string paramName, float value);
-
- // 语音相关
- public void OnLineStart(DialogText dialogText);
- public void OnLineShown();
-
- // 交互相关
- public void PlaySfx(string eventName, string audioKey);
- public void StopSfx(string eventName, STOP_MODE stopMode);
- public void SetSfxParam(string eventName, string paramName, float paramValue);
-
- // 暂停
- public void PauseAll();
- public void UnPauseAll();
- }
}
diff --git a/Assets/Scripts/Game Loop/EventEnums.cs b/Assets/Scripts/Game Loop/EventEnums.cs
index 58d42b8f6..fb927b523 100644
--- a/Assets/Scripts/Game Loop/EventEnums.cs
+++ b/Assets/Scripts/Game Loop/EventEnums.cs
@@ -52,32 +52,6 @@ namespace AibisDream
Selected
}
- public struct DialogText
- {
- public bool isOption;
- public string line;
- public CharacterVo actor;
- public string lineId;
-
- public static DialogText GetLine(LocalizedLine dialogueLine)
- {
- return new DialogText
- {
- isOption = false,
- line = dialogueLine.TextWithoutCharacterName.Text,
- lineId = dialogueLine.TextID,
- actor = dialogueLine.GetCharacterVo()
- };
- }
-
- public string GetRecordLine()
- {
- const string allowedTagsPattern = @"(<|{)(?!\/?(b|i|color)(?=>|\s|=))[^(>|})]+(>|})";
- var res = Regex.Replace(line, allowedTagsPattern, "");
- return res;
- }
- }
-
public enum StorageEvent
{
VariableSet,
diff --git a/Assets/Scripts/Utility/CommonUtil.cs b/Assets/Scripts/Utility/CommonUtil.cs
index 941ec7289..3b59afbde 100644
--- a/Assets/Scripts/Utility/CommonUtil.cs
+++ b/Assets/Scripts/Utility/CommonUtil.cs
@@ -270,6 +270,21 @@ namespace AibisDream.Utility
return Regex.Replace(str.Replace("
", "\n"), "[<|{].*?[>|}]", string.Empty);
}
+ ///
+ /// 诊疗记录展示用:去掉非 b/i/color 的富文本标签。
+ /// CJK 语言可直接去掉换行;其他语言需把 br 换成空格,避免单词粘连。
+ ///
+ public static string ToRecordLineText(this string str, bool replaceBrWithSpace)
+ {
+ const string brPattern = @"
";
+ var text = replaceBrWithSpace
+ ? Regex.Replace(str, brPattern, " ", RegexOptions.IgnoreCase)
+ : Regex.Replace(str, brPattern, string.Empty, RegexOptions.IgnoreCase);
+
+ const string allowedTagsPattern = @"(<|{)(?!\/?(b|i|color)(?=>|\s|=))[^(>|})]+(>|})";
+ return Regex.Replace(text, allowedTagsPattern, string.Empty);
+ }
+
public static int[,] DeserializeIntArray(string str)
{
if (string.IsNullOrWhiteSpace(str))