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,4 +1,6 @@
using System.Collections.Generic;
using UnityEngine;
using BaseGames.Localization;
namespace BaseGames.Dialogue
{
@@ -14,7 +16,7 @@ namespace BaseGames.Dialogue
/// 资产路径Assets/_Game/Data/NPC/NPC_{npcId}.asset
/// </summary>
[CreateAssetMenu(menuName = "BaseGames/NPC/NPC")]
public class NpcSO : ScriptableObject
public class NpcSO : ScriptableObject, ILocalizableAsset
{
[Header("标识")]
[Tooltip("NPC 唯一 ID如 \"NPC_Elder\"。需与 InteractableNPC._npcId 保持一致。")]
@@ -90,5 +92,14 @@ namespace BaseGames.Dialogue
}
}
#endif
public IEnumerable<LocalizationKeyRef> GetLocalizationKeys()
{
string table = string.IsNullOrEmpty(localizationTable) ? "UI" : localizationTable;
if (!string.IsNullOrEmpty(nameKey))
yield return new LocalizationKeyRef(nameKey, table, nameof(nameKey));
if (!string.IsNullOrEmpty(interactPromptKey))
yield return new LocalizationKeyRef(interactPromptKey, "UI", nameof(interactPromptKey));
}
}
}