Story排版

This commit is contained in:
SoulliesOfficial
2026-07-20 16:56:04 -04:00
parent 04ec368a59
commit c30bb258b1
107 changed files with 7794 additions and 969 deletions

View File

@@ -14,7 +14,7 @@ namespace Ichni.Story.UI
public TMP_Text storyIdText;
public TMP_Text titleText;
[Tooltip("三种状态对应的背景预制体,生成 block 时按当前状态实例化为第一个子物体")]
[Tooltip("状态对应的背景预制体。未配置 Forbidden 时会自动回退到 Locked 背景。")]
public Dictionary<StoryBlockState, GameObject> blockVisuals = new Dictionary<StoryBlockState, GameObject>();
/// <summary>该文本块对应的 Yarn 节点名。</summary>
@@ -59,14 +59,26 @@ namespace Ichni.Story.UI
_currentVisual = null;
}
if (blockVisuals == null ||
!blockVisuals.TryGetValue(newState, out GameObject prefab) ||
prefab == null)
if (blockVisuals == null)
{
Debug.LogWarning($"[TextBlockView] block '{blockId}' 缺少状态 {newState} 的背景预制体blockVisuals 未配置)。");
return;
}
// Forbidden 专用美术尚未配置前沿用 Locked 背景,保证互斥路线 Block 始终可见且不可点击。
// 后续只需在 Inspector 中补充 Forbidden 键,即可自动覆盖此回退表现。
if ((!blockVisuals.TryGetValue(newState, out GameObject prefab) || prefab == null) &&
newState == StoryBlockState.Forbidden)
{
blockVisuals.TryGetValue(StoryBlockState.Locked, out prefab);
}
if (prefab == null)
{
Debug.LogWarning($"[TextBlockView] block '{blockId}' 缺少状态 {newState} 的背景预制体。");
return;
}
_currentVisual = Instantiate(prefab, blockRect);
_currentVisual.transform.SetAsFirstSibling();