fix(dialog): 适配本地化架构变更自动同步对话语言
This commit is contained in:
@@ -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<LocalizedLine> GetLocalizedLineAsync(Yarn.Line line, CancellationToken cancellationToken)
|
||||
{
|
||||
// 每行对白即是消费点:在此同步一次当前语言,保证对话进行中切语言下一行立即生效
|
||||
_textLocaleCode = LocalizationKit.CurrentLanguageCode;
|
||||
_assetLocaleCode = LocalizationKit.CurrentLanguageCode;
|
||||
|
||||
string sourceLineID = line.ID;
|
||||
|
||||
string[] metadata = System.Array.Empty<string>();
|
||||
|
||||
@@ -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<DialogController>
|
||||
{
|
||||
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 推进方式修改
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using AibisDream.Utility;
|
||||
using UnityEngine;
|
||||
using Yarn.Unity;
|
||||
|
||||
Reference in New Issue
Block a user