Story排版
This commit is contained in:
@@ -27,7 +27,7 @@ namespace Ichni.Story.UI
|
||||
/// 初始化 block 视图。逻辑坐标已由控制器按网格换算为 <paramref name="position"/>
|
||||
/// (以 BlockContainer 左侧中线为原点、x 向右为正、y 向下为正的 anchoredPosition)。
|
||||
/// </summary>
|
||||
/// <param name="def">block 定义(提供尺寸与类型专属数据)。</param>
|
||||
/// <param name="def">Block 定义(提供类型专属数据与剧情配置)。</param>
|
||||
/// <param name="position">已换算好的 anchoredPosition。</param>
|
||||
/// <param name="blockState">推导得到的 block 状态。</param>
|
||||
public virtual void Initialize(StoryBlockDefinition def, Vector2 position, StoryBlockState blockState)
|
||||
@@ -36,11 +36,16 @@ namespace Ichni.Story.UI
|
||||
blockId = def.blockId;
|
||||
state = blockState;
|
||||
|
||||
// 统一坐标约定:以 BlockContainer 的左侧中线为原点,向右为 +x、向下为 +y。
|
||||
// 统一坐标约定:以 BlockContainer 的左侧中线为原点,Block 的中心向右为 +x、向下为 +y。
|
||||
// 所有类型使用中心 Pivot,使相同 gridColumn 始终代表同一条视觉中心列,
|
||||
// 不会再因 Important / Secondary / Song / Tutorial 的宽度不同而产生左右间距不对称。
|
||||
blockRect.anchorMin = new Vector2(0f, 0.5f);
|
||||
blockRect.anchorMax = new Vector2(0f, 0.5f);
|
||||
blockRect.pivot = new Vector2(0f, 0.5f);
|
||||
blockRect.sizeDelta = new Vector2(400, 200);
|
||||
blockRect.pivot = new Vector2(0.5f, 0.5f);
|
||||
|
||||
// 不在基类覆盖 sizeDelta:Block 的尺寸是 Prefab 的视觉契约。
|
||||
// Important / Secondary TextBlock,以及未来不同尺寸的 Song / Tutorial Block,
|
||||
// 都可保留各自的宽高;StoryTreeController 会据此计算 Content 边界和连接线端口。
|
||||
blockRect.anchoredPosition = position;
|
||||
|
||||
if (button != null)
|
||||
@@ -58,12 +63,12 @@ namespace Ichni.Story.UI
|
||||
state = newState;
|
||||
|
||||
if (button != null)
|
||||
button.interactable = state != StoryBlockState.Locked;
|
||||
button.interactable = state != StoryBlockState.Locked && state != StoryBlockState.Forbidden;
|
||||
}
|
||||
|
||||
private void HandleClick()
|
||||
{
|
||||
if (state == StoryBlockState.Locked)
|
||||
if (state == StoryBlockState.Locked || state == StoryBlockState.Forbidden)
|
||||
return;
|
||||
|
||||
if (StoryManager.instance != null && StoryManager.instance.treeController != null)
|
||||
|
||||
Reference in New Issue
Block a user