阶段性完成
This commit is contained in:
@@ -3,7 +3,9 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Sirenix.OdinInspector;
|
||||
using UnityEditor;
|
||||
using UnityEditor.Localization;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Localization;
|
||||
|
||||
namespace Ichni.Story
|
||||
{
|
||||
@@ -146,10 +148,7 @@ namespace Ichni.Story
|
||||
issues.Add($"[Error] Timeline Marker '{marker.markerId}' 的 Anchor Block '{marker.anchorBlockId}' 不是 TextBlock。");
|
||||
}
|
||||
|
||||
if (string.IsNullOrWhiteSpace(marker.labelKey))
|
||||
{
|
||||
issues.Add($"[Warning] Timeline Marker '{marker.markerId}' 未配置 Label Key。");
|
||||
}
|
||||
ValidateLocalizedString(marker.label, $"Timeline Marker '{marker.markerId}' Label", issues);
|
||||
}
|
||||
|
||||
ValidateTimelineMarkerAnchors(reachableBlockIds, issues);
|
||||
@@ -203,8 +202,10 @@ namespace Ichni.Story
|
||||
|
||||
switch (block.blockType)
|
||||
{
|
||||
case StoryBlockType.Text when string.IsNullOrWhiteSpace(block.yarnNodeName):
|
||||
issues.Add($"[Warning] TextBlock '{block.blockId}' 未配置 Yarn Node。");
|
||||
case StoryBlockType.Text:
|
||||
if (string.IsNullOrWhiteSpace(block.yarnNodeName))
|
||||
issues.Add($"[Warning] TextBlock '{block.blockId}' 未配置 Yarn Node。");
|
||||
ValidateLocalizedString(block.title, $"TextBlock '{block.blockId}' Title", issues);
|
||||
break;
|
||||
case StoryBlockType.Song when string.IsNullOrWhiteSpace(block.songName):
|
||||
issues.Add($"[Warning] SongBlock '{block.blockId}' 未配置 Song ID。");
|
||||
@@ -295,6 +296,36 @@ namespace Ichni.Story
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 检查 LocalizedString 是否已选择有效的 String Table 与 Entry。
|
||||
/// 只读取 Unity Localization 的 Shared Table Data,不加载 Addressables,也不修改资产;
|
||||
/// 因此可在 StoryData Inspector 中尽早发现 CSV 尚未导入或引用错误。
|
||||
/// </summary>
|
||||
private static void ValidateLocalizedString(
|
||||
LocalizedString reference,
|
||||
string owner,
|
||||
List<string> issues)
|
||||
{
|
||||
if (reference == null || reference.IsEmpty)
|
||||
{
|
||||
issues.Add($"[Warning] {owner} 未配置 LocalizedString。");
|
||||
return;
|
||||
}
|
||||
|
||||
StringTableCollection tableCollection =
|
||||
LocalizationEditorSettings.GetStringTableCollection(reference.TableReference);
|
||||
if (tableCollection?.SharedData == null)
|
||||
{
|
||||
issues.Add($"[Error] {owner} 引用的 String Table '{reference.TableReference}' 不存在或无法读取 Shared Table Data。");
|
||||
return;
|
||||
}
|
||||
|
||||
if (tableCollection.SharedData.GetEntryFromReference(reference.TableEntryReference) == null)
|
||||
{
|
||||
issues.Add($"[Error] {owner} 引用的 Entry '{reference.TableEntryReference}' 不存在于 String Table '{tableCollection.TableCollectionName}'。");
|
||||
}
|
||||
}
|
||||
|
||||
private HashSet<string> ValidateStoryGraph(HashSet<string> blockIds, List<string> issues)
|
||||
{
|
||||
Dictionary<string, List<string>> adjacency = new Dictionary<string, List<string>>();
|
||||
|
||||
Reference in New Issue
Block a user