优化hierarchy

即时生成和删除tab(不会做动态刷新
基本上hierarchy的性能就到这了,之后还是做点辅助工具防止1000+的栏展开吧
(重要)bug测试不完全,需要再加改进
This commit is contained in:
2025-02-12 01:57:18 +08:00
parent 30653e133b
commit 1b3c3556a1
8 changed files with 72 additions and 36 deletions

View File

@@ -1,6 +1,7 @@
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame;
using Unity.VisualScripting;
using UnityEngine;
using UnityEngine.UI;
@@ -8,16 +9,24 @@ namespace Ichni.Editor
{
public class Hierarchy : StaticWindow
{
public GameObject Nouse;
public GameObject hierarchyTabPrefab;
public RectTransform tabContainer;
public List<HierarchyTab> tabList;
//public int ID=0;
public void GenerateTab(GameElement targetElement, GameElement parentElement)
public HierarchyTab GenerateTab(GameElement targetElement, GameElement parentElement,int reuse=-1)
{
HierarchyTab tab = Instantiate(hierarchyTabPrefab, tabContainer).GetComponent<HierarchyTab>();
HierarchyTab tab =Instantiate(hierarchyTabPrefab, tabContainer).GetComponent<HierarchyTab>();;
//if(parentElement.connectedTab!=null)tab.transform.SetSiblingIndex(parentElement.connectedTab.transform.GetSiblingIndex());
tab.SetTab(targetElement, parentElement);
tabList.Add(tab);
tab.hierarchy=this;
return tab;
}