改东西

Signed-off-by: TRAfoer <lhf190@outlook.com>
This commit is contained in:
2025-07-09 17:02:47 +08:00
parent bcf96b1c02
commit 1a632aea4a
9 changed files with 183 additions and 1705 deletions

View File

@@ -81,6 +81,13 @@ namespace Ichni.Editor
public Vector2 vector2;
public void FindTab(GameElement targetElement)
{
if (targetElement.connectedTab != null)
{
// 如果已经有Tab了直接选中
targetElement.connectedTab.SelectGameElement();
getTabPos(targetElement.connectedTab);
return;
}
targetElement.ScanAndAddEnableTypes();
if (!EditorManager.instance.ExpandWhileClick)
{
@@ -144,11 +151,17 @@ namespace Ichni.Editor
yield return null;
}
yield return null; // 等待一帧确保UI更新
getTabPos(targetElement.connectedTab);
}
void getTabPos(HierarchyTab finalTab)
{
HierarchyTab finalTab = targetElement.connectedTab;
// 修正定位算法
yield return null; // 等待布局刷新
RectTransform tabRect = finalTab.GetComponent<RectTransform>();
RectTransform containerRect = tabContainer;
RectTransform viewportRect = scrollRect.viewport != null ? scrollRect.viewport : scrollRect.GetComponent<RectTransform>();
@@ -170,7 +183,7 @@ namespace Ichni.Editor
scrollRect.verticalNormalizedPosition = normalized;
finalTab.SelectGameElement();
}
}
}
}