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))