UI系统优化

This commit is contained in:
2026-05-25 11:54:37 +08:00
parent c7057db27d
commit 3c812cfb41
130 changed files with 4738 additions and 477 deletions

View File

@@ -1,5 +1,7 @@
using System.Collections.Generic;
using UnityEngine;
using BaseGames.Core;
using BaseGames.Localization;
namespace BaseGames.Dialogue
{
@@ -80,7 +82,7 @@ namespace BaseGames.Dialogue
/// 资产路径: Assets/ScriptableObjects/Dialogue/DLG_{NpcId}_{Context}.asset
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/Dialogue/DialogueSequence")]
public class DialogueSequenceSO : ScriptableObject
public class DialogueSequenceSO : ScriptableObject, ILocalizableAsset
{
[Header("标识")]
[Tooltip("序列唯一 ID如 \"DLG_Elder_Quest_Available\"。OnValidate 会自动以资产名填充,也可手动指定。")]
@@ -320,5 +322,22 @@ namespace BaseGames.Dialogue
return false;
}
#endif
public IEnumerable<LocalizationKeyRef> GetLocalizationKeys()
{
if (lines == null) yield break;
foreach (var line in lines)
{
if (!string.IsNullOrEmpty(line.textKey))
yield return new LocalizationKeyRef(line.textKey, "Dialogue", "lines.textKey");
// speakerNameKey only relevant when actor is absent (override path)
if (line.actor == null && !string.IsNullOrEmpty(line.speakerNameKey))
yield return new LocalizationKeyRef(line.speakerNameKey, "Dialogue", "lines.speakerNameKey");
if (line.choices != null)
foreach (var choice in line.choices)
if (!string.IsNullOrEmpty(choice.textKey))
yield return new LocalizationKeyRef(choice.textKey, "Dialogue", "lines.choices.textKey");
}
}
}
}