diff --git a/Assets/Scripts/Dialog System/AibisLineProvider.cs b/Assets/Scripts/Dialog System/AibisLineProvider.cs index 8bf066ff4..d6c648f66 100644 --- a/Assets/Scripts/Dialog System/AibisLineProvider.cs +++ b/Assets/Scripts/Dialog System/AibisLineProvider.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using System.Threading; using AibisDream.Framework; using AibisDream.Utility; @@ -47,6 +47,10 @@ namespace AibisDream public override async YarnTask GetLocalizedLineAsync(Yarn.Line line, CancellationToken cancellationToken) { + // 每行对白即是消费点:在此同步一次当前语言,保证对话进行中切语言下一行立即生效 + _textLocaleCode = LocalizationKit.CurrentLanguageCode; + _assetLocaleCode = LocalizationKit.CurrentLanguageCode; + string sourceLineID = line.ID; string[] metadata = System.Array.Empty(); diff --git a/Assets/Scripts/Dialog System/DialogController.cs b/Assets/Scripts/Dialog System/DialogController.cs index 027a3d2b8..b5cba2928 100644 --- a/Assets/Scripts/Dialog System/DialogController.cs +++ b/Assets/Scripts/Dialog System/DialogController.cs @@ -1,15 +1,14 @@ using System; -using AibisDream.Framework; using AibisDream.Kit; using UnityEngine; using UnityEngine.Events; +using AibisDream.Framework; using Yarn.Unity; namespace AibisDream { public class DialogController : Singleton { - private const string DefaultDialogueLocaleCode = "zh-Hans"; private DialogueRunner _dialogueRunner; [SerializeField] private LineAdvanceInput lineAdvanceInput; @@ -74,7 +73,6 @@ namespace AibisDream public void StartDialog(YarnProject yarnProject) { _dialogueRunner.SetProject(yarnProject); - ConfigureLineProviderLocale(); _ = _dialogueRunner.StartDialogue("Start"); } @@ -88,7 +86,6 @@ namespace AibisDream public void LoadDialog(YarnProject yarnProject) { _dialogueRunner.SetProject(yarnProject); - ConfigureLineProviderLocale(); _ = _dialogueRunner.StartDialogue("Center"); } @@ -132,14 +129,6 @@ namespace AibisDream } } - private void ConfigureLineProviderLocale() - { - if (_dialogueRunner.LineProvider is LineProviderBehaviour lineProvider) - { - lineProvider.LocaleCode = DefaultDialogueLocaleCode; - } - } - #endregion #region 推进方式修改 diff --git a/Assets/Scripts/Dialog System/LineRunner.cs b/Assets/Scripts/Dialog System/LineRunner.cs index f09026df7..b04b725f1 100644 --- a/Assets/Scripts/Dialog System/LineRunner.cs +++ b/Assets/Scripts/Dialog System/LineRunner.cs @@ -1,4 +1,4 @@ -using System.Collections.Generic; +using System.Collections.Generic; using AibisDream.Utility; using UnityEngine; using Yarn.Unity;