Story流程+本地化
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
using Ichni.Story.Dialogue;
|
||||
using Ichni.Story.UI;
|
||||
using Ichni.Localization;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Localization.Settings;
|
||||
using Yarn.Unity;
|
||||
|
||||
namespace Ichni.Story.YarnFunctions
|
||||
@@ -34,6 +34,10 @@ namespace Ichni.Story.YarnFunctions
|
||||
MessageUIPage.instance.ShowUnlockMessage(songUnlockKey);
|
||||
else
|
||||
Debug.LogError("[StoryTreeCommands] 弹窗失败:场景中未找到 StoryMessageBoxUIPage 实例!");
|
||||
|
||||
// 解锁 Key 已写入 UnlockSaveModule,但当前 StoryPage 的 SongBlock 已经实例化,
|
||||
// 不会自动重新读取授权状态。立刻刷新可让遮罩、按钮交互和后续 Block 状态与新存档同步。
|
||||
StoryManager.instance?.treeController?.RefreshAllStates();
|
||||
});
|
||||
}
|
||||
|
||||
@@ -126,20 +130,7 @@ namespace Ichni.Story.YarnFunctions
|
||||
|
||||
private static string GetTranslatedText(string tableName, string key)
|
||||
{
|
||||
if (string.IsNullOrEmpty(key)) return string.Empty;
|
||||
|
||||
try
|
||||
{
|
||||
// 尝试从 Unity Localization 中获取翻译文本
|
||||
string translated = LocalizationSettings.StringDatabase.GetLocalizedString(tableName, key);
|
||||
// 若获取失败或为空,则直接原样返回 key 作为兜底文本
|
||||
return string.IsNullOrEmpty(translated) ? key : translated;
|
||||
}
|
||||
catch
|
||||
{
|
||||
// 如果表不存在或其他异常,返回原 key
|
||||
return key;
|
||||
}
|
||||
return LocalizationTextService.Resolve(tableName, key, key);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user