选择可显示项

本来想做启闭的懒得做了
This commit is contained in:
2025-06-29 19:52:19 +08:00
parent 1b87a4345b
commit b85e29c540
7 changed files with 423 additions and 134 deletions

View File

@@ -19097,10 +19097,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 5820 m_fileSize: 5820
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154040
m_fileWriteTS: 1751096998 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751096998 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 6180f4f2f0336466999b9e6e9beea8ea - guid: 6180f4f2f0336466999b9e6e9beea8ea
@@ -21340,15 +21340,15 @@ MonoBehaviour:
UseGUIDsList: [] UseGUIDsList: []
- guid: 81e2cda70e8084a3fb324d644db244fd - guid: 81e2cda70e8084a3fb324d644db244fd
type: 5 type: 5
m_fileInfoHash: 275823.asset m_fileInfoHash: 278627.asset
m_assetbundle: m_assetbundle:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 275823 m_fileSize: 278627
m_assetChangeTS: 1751125161 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751125176 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1751125160 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751125160 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: UseGUIDsList:
- guid: e6b16dc7c203450459bb86e24305f9ca - guid: e6b16dc7c203450459bb86e24305f9ca
@@ -27273,15 +27273,15 @@ MonoBehaviour:
UseGUIDsList: [] UseGUIDsList: []
- guid: e1260c1148f6143b28bae5ace5e9c5d1 - guid: e1260c1148f6143b28bae5ace5e9c5d1
type: 5 type: 5
m_fileInfoHash: 3642.asset m_fileInfoHash: 3756.asset
m_assetbundle: m_assetbundle:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 3642 m_fileSize: 3756
m_assetChangeTS: 1751126615 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126681 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1751126615 m_fileWriteTS: 1751153820
m_cachefileWriteTS: 1751126615 m_cachefileWriteTS: 1751153820
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: UseGUIDsList:
- guid: bf2edee5c58d82540a51f03df9d42094 - guid: bf2edee5c58d82540a51f03df9d42094
@@ -35861,10 +35861,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 30929 m_fileSize: 30929
m_assetChangeTS: 1751123120 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751123128 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1751097629 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751097629 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 92c1b588d7658594cb219696f593f64b - guid: 92c1b588d7658594cb219696f593f64b
@@ -60343,10 +60343,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 4543 m_fileSize: 4543
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1751096060 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751096060 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 544e4fbf839e39e1b693958db86e8cc8 - guid: 544e4fbf839e39e1b693958db86e8cc8
@@ -64482,15 +64482,15 @@ MonoBehaviour:
UseGUIDsList: [] UseGUIDsList: []
- guid: a48a638548bdb6645bfa74867dc72087 - guid: a48a638548bdb6645bfa74867dc72087
type: 2 type: 2
m_fileInfoHash: 9204.cs m_fileInfoHash: 9146.cs
m_assetbundle: m_assetbundle:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 9204 m_fileSize: 9146
m_assetChangeTS: 1750597263 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1750597272 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1750597147 m_fileWriteTS: 1751098957
m_cachefileWriteTS: 1750597147 m_cachefileWriteTS: 1751098957
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: a48a9e08d9023374fab5d929e609b9bd - guid: a48a9e08d9023374fab5d929e609b9bd
@@ -80185,10 +80185,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 3941 m_fileSize: 3941
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751097007 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751097007 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: d5c2f1d0a3c6acc4a9cf0d8f013f14d3 - guid: d5c2f1d0a3c6acc4a9cf0d8f013f14d3
@@ -97378,10 +97378,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 192 m_fileSize: 192
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751095031 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751095031 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 17eaa6370b3e28741af24fa5d835972a - guid: 17eaa6370b3e28741af24fa5d835972a
@@ -101535,10 +101535,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 13331 m_fileSize: 13331
m_assetChangeTS: 1751125689 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751125698 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751125563 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751125563 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 67a774c4384aa6c488128e2851b18ced - guid: 67a774c4384aa6c488128e2851b18ced
@@ -158736,10 +158736,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 240 m_fileSize: 240
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751095031 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751095031 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 9b821aa41cbf734458af19d8c6507e92 - guid: 9b821aa41cbf734458af19d8c6507e92
@@ -164608,10 +164608,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 87248 m_fileSize: 87248
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751095031 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751095031 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 0c840ddd1fdb040759e04bfab84c6cab - guid: 0c840ddd1fdb040759e04bfab84c6cab
@@ -184464,10 +184464,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 6947 m_fileSize: 6947
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751096970 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751096970 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 7d07c5b68c1cfe64ca63f5d2bb80d2c5 - guid: 7d07c5b68c1cfe64ca63f5d2bb80d2c5
@@ -190538,10 +190538,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 320 m_fileSize: 320
m_assetChangeTS: 1751097009 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751097023 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751095031 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751095031 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: ed7cb8f9a27664e48896c904189f0e2c - guid: ed7cb8f9a27664e48896c904189f0e2c
@@ -193410,15 +193410,15 @@ MonoBehaviour:
ids: 73000000 ids: 73000000
- guid: 2e498d1c8094910479dc3e1b768306a4 - guid: 2e498d1c8094910479dc3e1b768306a4
type: 5 type: 5
m_fileInfoHash: 9628.asset m_fileInfoHash: 9987.asset
m_assetbundle: m_assetbundle:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 9628 m_fileSize: 9987
m_assetChangeTS: 1751126615 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126681 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751126615 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751126615 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: UseGUIDsList:
- guid: fe393ace9b354375a9cb14cdbbc28be4 - guid: fe393ace9b354375a9cb14cdbbc28be4
@@ -212430,10 +212430,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 3518 m_fileSize: 3518
m_assetChangeTS: 1751126489 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126497 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751126485 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751126485 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: af51737994209402685054b8c8721aab - guid: af51737994209402685054b8c8721aab
@@ -217278,10 +217278,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 31432 m_fileSize: 31432
m_assetChangeTS: 1751123120 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751123128 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1751097672 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751097672 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 78a029f080e58c64fbb4ed9d609f7d12 - guid: 78a029f080e58c64fbb4ed9d609f7d12
@@ -217369,10 +217369,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 1950982 m_fileSize: 1950982
m_assetChangeTS: 1751126618 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126681 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751126594 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751126594 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: a343a8560a860bf4188c8f63103f455a - guid: a343a8560a860bf4188c8f63103f455a
@@ -217468,10 +217468,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 4945 m_fileSize: 4945
m_assetChangeTS: 1751126046 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126053 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751126035 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751126035 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
- guid: 4dbc31cf60d8a0549a2be9b95e816376 - guid: 4dbc31cf60d8a0549a2be9b95e816376
@@ -217536,15 +217536,15 @@ MonoBehaviour:
ids: ids:
- guid: 85c3e9578b45a414bb6507f90e48720a - guid: 85c3e9578b45a414bb6507f90e48720a
type: 5 type: 5
m_fileInfoHash: 358153.prefab m_fileInfoHash: 372923.prefab
m_assetbundle: m_assetbundle:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 358153 m_fileSize: 372923
m_assetChangeTS: 1751126079 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126080 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751126079 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751126079 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: UseGUIDsList:
- guid: 235f9435448da714a924218ed6ead5ea - guid: 235f9435448da714a924218ed6ead5ea
@@ -218684,15 +218684,15 @@ MonoBehaviour:
UseGUIDsList: [] UseGUIDsList: []
- guid: 235f9435448da714a924218ed6ead5ea - guid: 235f9435448da714a924218ed6ead5ea
type: 5 type: 5
m_fileInfoHash: 12979.mat m_fileInfoHash: 13466.mat
m_assetbundle: m_assetbundle:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 12979 m_fileSize: 13466
m_assetChangeTS: 1751125057 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751125129 m_fileInfoReadTS: 1751154039
m_fileWriteTS: 1751125057 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751125057 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: UseGUIDsList:
- guid: 4af258f019782954c9c32cd616f51c3b - guid: 4af258f019782954c9c32cd616f51c3b
@@ -218746,8 +218746,8 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 0 m_fileSize: 0
m_assetChangeTS: 1751124774 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751124798 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 0 m_fileWriteTS: 0
m_cachefileWriteTS: 0 m_cachefileWriteTS: 0
refreshStamp: 3 refreshStamp: 3
@@ -218759,10 +218759,10 @@ MonoBehaviour:
m_addressable: m_addressable:
m_atlas: m_atlas:
m_fileSize: 1301 m_fileSize: 1301
m_assetChangeTS: 1751126248 m_assetChangeTS: 1751154020
m_fileInfoReadTS: 1751126257 m_fileInfoReadTS: 1751154038
m_fileWriteTS: 1751126224 m_fileWriteTS: 1751153823
m_cachefileWriteTS: 1751126224 m_cachefileWriteTS: 1751153823
refreshStamp: 3 refreshStamp: 3
UseGUIDsList: [] UseGUIDsList: []
setting: setting:

View File

@@ -41,8 +41,18 @@ namespace Ichni.Editor
} }
public IEnumerator TryGetTab(GameElement targetElement) public IEnumerator TryGetTab(GameElement targetElement)
{ {
// targetElement.ScanAndAddEnableTypes();
StandardInspectionElement.GenerateForLoading(); // if (!targetElement.GetChildrenByTypes().Contains(targetElement))
// {
// var tab = EditorManager.instance.uiManager.hierarchy.GenerateTab(targetElement, null);
// tab.SelectGameElement();
// Destroy(tab.gameObject);
// EditorManager.instance.uiManager.hierarchy.tabList.Remove(tab);
// yield break;
// }
// EditorManager.instance.uiManager.inspector.ClearInspector();
// EditorManager.instance.uiManager.inspector.SetInspector(targetElement);
//StandardInspectionElement.GenerateForLoading();
// 1. 向上找到最近的有Tab的祖先 // 1. 向上找到最近的有Tab的祖先
Stack<GameElement> stack = new Stack<GameElement>(); Stack<GameElement> stack = new Stack<GameElement>();
GameElement current = targetElement; GameElement current = targetElement;
@@ -58,9 +68,17 @@ namespace Ichni.Editor
{ {
var elem = stack.Pop(); var elem = stack.Pop();
// 只展开父Tab不直接生成Tab // 只展开父Tab不直接生成Tab
if (elem.parentElement != null && elem.parentElement.connectedTab != null && !elem.parentElement.connectedTab.isExpanded) if (elem.parentElement != null && elem.parentElement.connectedTab != null)
{ {
elem.parentElement.connectedTab.ExpandOrFold(); if (!elem.parentElement.connectedTab.isExpanded)
{
elem.parentElement.connectedTab.ExpandOrFold(true);
}
else
{
elem.parentElement.connectedTab.ExpandOrFold();
elem.parentElement.connectedTab.ExpandOrFold(true);//合上再展开,这思路也是没谁了
}
yield return null; yield return null;
} }
// 等待当前elem的Tab生成 // 等待当前elem的Tab生成
@@ -72,15 +90,36 @@ namespace Ichni.Editor
} }
// 3. 等待目标Tab实例化 // 3. 等待目标Tab实例化
while (targetElement.connectedTab == null) while (targetElement.connectedTab is null)
{ {
yield return null; yield return null;
} }
HierarchyTab finalTab = targetElement.connectedTab; HierarchyTab finalTab = targetElement.connectedTab;
float Tablocalpos = (-finalTab.transform.localPosition.y) - (tabContainer.sizeDelta.y / 4f);
float pct = Tablocalpos / tabContainer.sizeDelta.y; // 修正定位算法
scrollRect.verticalNormalizedPosition = 1f - pct; yield return null; // 等待布局刷新
RectTransform tabRect = finalTab.GetComponent<RectTransform>();
RectTransform containerRect = tabContainer;
RectTransform viewportRect = scrollRect.viewport != null ? scrollRect.viewport : scrollRect.GetComponent<RectTransform>();
// Tab相对于内容顶部的距离正值为下负值为上
float tabTop = -tabRect.anchoredPosition.y;
float tabHeight = tabRect.rect.height;
float contentHeight = containerRect.rect.height;
float viewportHeight = viewportRect.rect.height;
// 目标让Tab居中或尽量居中
float targetCenter = tabTop + tabHeight / 2f;
float viewportCenter = viewportHeight / 2f;
float scrollOffset = targetCenter - viewportCenter;
// normalizedPosition = 1 - (scrollOffset / (contentHeight - viewportHeight))
float denominator = Mathf.Max(1f, contentHeight - viewportHeight);
float normalized = 1f - Mathf.Clamp01(scrollOffset / denominator);
scrollRect.verticalNormalizedPosition = normalized;
finalTab.SelectGameElement(); finalTab.SelectGameElement();
} }
} }

View File

@@ -125,24 +125,33 @@ namespace Ichni.Editor
EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement); EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement);
EditorManager.instance.timeline.SetTimeLine(connectedGameElement); EditorManager.instance.timeline.SetTimeLine(connectedGameElement);
} }
private IEnumerator ienumerator = null;
public void ExpandOrFold() public void ExpandOrFold()
{
ExpandOrFold(false);
}
public void ExpandOrFold(bool forceAllExPand = false)
{ {
this.childTabList.RemoveAll(s => s == null); this.childTabList.RemoveAll(s => s == null);
isExpanded = !isExpanded; isExpanded = !isExpanded;
ExpandAnim(); ExpandAnim();
if (isExpanded) if (isExpanded)
{ {
connectedGameElement.ScanAndAddEnableTypes();
List<GameElement> FixedList = !forceAllExPand ? connectedGameElement.GetChildrenByTypes() : connectedGameElement.childElementList;
// float startTime = Time.realtimeSinceStartup; // float startTime = Time.realtimeSinceStartup;
// connectedGameElement.childElementList.Sort();//TODO: 后续可以让玩家手动快速排序 // connectedGameElement.childElementList.Sort();//TODO: 后续可以让玩家手动快速排序
// Debug.Log("排序耗时 " + (Time.realtimeSinceStartup - startTime).ToString()); Debug.Log(FixedList.Count);
StartCoroutine(ExpandOverTime()); ienumerator = ExpandOverTime(FixedList);
StartCoroutine(ienumerator);
} }
else else
{ {
//expandButton.transform.Rotate(new Vector3(0, 0, 180)); //expandButton.transform.Rotate(new Vector3(0, 0, 180));
StopCoroutine(ienumerator);
ienumerator = null;
for (int i = childTabList.Count - 1; i >= 0; i--) for (int i = childTabList.Count - 1; i >= 0; i--)
{ {
childTabList[i].SetExpansion(isExpanded); childTabList[i].SetExpansion(isExpanded);
@@ -171,11 +180,11 @@ namespace Ichni.Editor
{ {
expandButton.transform.DORotate(new Vector3(0, 0, !isExpanded ? 0f : 180f), 0.2f); expandButton.transform.DORotate(new Vector3(0, 0, !isExpanded ? 0f : 180f), 0.2f);
} }
private IEnumerator ExpandOverTime()//帧率过低的时候等一下再实例化 private IEnumerator ExpandOverTime(List<GameElement> FixedList)//帧率过低的时候等一下再实例化
{ {
float startTime = Time.realtimeSinceStartup; float startTime = Time.realtimeSinceStartup;
for (var index = 0; index < connectedGameElement.childElementList.Count; index++) for (var index = 0; index < FixedList.Count; index++)
{ {
int hasYield = 0; int hasYield = 0;
while (Time.realtimeSinceStartup - startTime > 1f / EditorManager.instance.editorSettings.frameRate * 3f && hasYield <= 2) while (Time.realtimeSinceStartup - startTime > 1f / EditorManager.instance.editorSettings.frameRate * 3f && hasYield <= 2)
@@ -183,8 +192,9 @@ namespace Ichni.Editor
yield return null; yield return null;
hasYield += 1; hasYield += 1;
} }
var childElement = connectedGameElement.childElementList[index]; var childElement = FixedList[index];
EditorManager.instance.uiManager.hierarchy.GenerateTab(childElement, connectedGameElement); EditorManager.instance.uiManager.hierarchy.GenerateTab(childElement, connectedGameElement);
print($"生成子Tab{childElement.elementName},索引:{index},总数:{FixedList.Count}");
} }
} }
} }

View File

@@ -1,6 +1,7 @@
using System; using System;
using System.Collections; using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Dreamteck.Splines; using Dreamteck.Splines;
using Ichni.Editor; using Ichni.Editor;
using Ichni.RhythmGame.Beatmap; using Ichni.RhythmGame.Beatmap;
@@ -161,10 +162,54 @@ namespace Ichni.RhythmGame
} }
} }
public abstract partial class GameElement public abstract partial class GameElement//Editor 专
{ {
public class EnableType : IBaseElement
{
public Type type;
public bool enable;
public BaseElement_BM matchedBM { get => throw new NotImplementedException(); set => throw new NotImplementedException(); }
};
public List<EnableType> enableTypes;
/// <summary>
/// 扫描childElementList中的类型并加入enableTypes去重兼容性好
/// </summary>
public void ScanAndAddEnableTypes()
{
// 初始化enableTypes列表
if (enableTypes == null)
enableTypes = new List<EnableType>();
// 记录已存在的类型,避免重复
HashSet<Type> existingTypes = new HashSet<Type>();
foreach (var et in enableTypes)
{
if (et != null && et.type != null)
existingTypes.Add(et.type);
}
// 遍历所有子元素类型若未添加则加入enableTypes
foreach (var child in childElementList)
{
var childType = child.GetType();
if (!existingTypes.Contains(childType))
{
enableTypes.Add(new EnableType
{
type = childType,
enable = true
});
existingTypes.Add(childType);
}
}
}
public virtual void SetUpInspector() //被点击时设置第一层Inspector public virtual void SetUpInspector() //被点击时设置第一层Inspector
{ {
ScanAndAddEnableTypes();
IHaveInspection inspector = EditorManager.instance.uiManager.inspector; IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Element Info"); var container = inspector.GenerateContainer("Element Info");
@@ -177,6 +222,30 @@ namespace Ichni.RhythmGame
inspector.GenerateCompositeParameterWindow(this, "Tags List", nameof(tags)).SetAsStringList(); inspector.GenerateCompositeParameterWindow(this, "Tags List", nameof(tags)).SetAsStringList();
}); });
// 只用反射方式生成enableTypes的UI
if (enableTypes != null && enableTypes.Count > 0)
{
var elcontainer = inspector.GenerateContainer("Enable Children DisPlay");
var enableTypeContainer = elcontainer.GenerateSubcontainer(3);
var type = enableTypes.GetType().GetGenericArguments()[0];
int elcount = 0;
for (int idx = 0; idx < enableTypes.Count; idx++)
{
elcount++;
if (elcount > 3)
{
elcount = 0;
enableTypeContainer = elcontainer.GenerateSubcontainer(3);
}
var et = enableTypes[idx];
inspector.GenerateToggle(
et,
enableTypeContainer,
et.type.Name,
nameof(et.enable) // 传递字段名字符串
);
}
}
//次级模块 //次级模块
foreach (var submodule in submoduleList) foreach (var submodule in submoduleList)
{ {
@@ -207,6 +276,30 @@ namespace Ichni.RhythmGame
return gameElements; return gameElements;
} }
/// <summary>
/// 根据enableTypes筛选子元素只返回enable为true的类型对应的子元素
/// </summary>
public List<GameElement> GetChildrenByTypes()
{
if (enableTypes == null || enableTypes.Count == 0)
return new List<GameElement>();
var enabledTypes = new HashSet<Type>();
foreach (var et in enableTypes)
{
if (et.enable) enabledTypes.Add(et.type);
}
// 问题1只匹配类型本身不能处理继承关系如子类/接口)
// 问题2如果childElementList有null元素会抛异常
// 问题3如果enableTypes有重复type没影响但没必要
// 更健壮的写法如下支持继承和接口避免null
return childElementList.FindAll(child =>
child != null && enabledTypes.Any(t => t.IsAssignableFrom(child.GetType()))
);
}
} }
namespace Beatmap namespace Beatmap

View File

@@ -13,6 +13,8 @@ namespace Ichni.RhythmGame
{ {
public partial class TrackRendererSubmodule : TrackSubmodule public partial class TrackRendererSubmodule : TrackSubmodule
{ {
protected int submoduleNameIndex = 0;
protected readonly string[] submoduleName = { "Auto Orient", "Path Generator", "Tube Generator", "Surface" };
public MeshGenerator meshGenerator; public MeshGenerator meshGenerator;
public MeshRenderer meshRenderer; public MeshRenderer meshRenderer;
public Material renderMaterial; public Material renderMaterial;
@@ -42,7 +44,7 @@ namespace Ichni.RhythmGame
this.materialThemeBundleName = materialThemeBundleName; this.materialThemeBundleName = materialThemeBundleName;
this.materialName = materialName; this.materialName = materialName;
Material mat = ThemeBundleManager.instance.GetObject<Material>(materialThemeBundleName, materialName); Material mat = ThemeBundleManager.instance.GetObject<Material>(materialThemeBundleName, materialName);
if(mat != null) if (mat != null)
{ {
renderMaterial = mat; renderMaterial = mat;
meshRenderer.material = renderMaterial; meshRenderer.material = renderMaterial;
@@ -54,7 +56,7 @@ namespace Ichni.RhythmGame
SetEnableZWrite(); SetEnableZWrite();
SetEnableEmission(); SetEnableEmission();
SetEmissionIntensity(); SetEmissionIntensity();
if (track.trackTimeSubmodule is TrackTimeSubmoduleMovable) if (track.trackTimeSubmodule is TrackTimeSubmoduleMovable)
{ {
meshGenerator.clipFrom = 0; meshGenerator.clipFrom = 0;
@@ -86,9 +88,11 @@ namespace Ichni.RhythmGame
IHaveInspection inspector = EditorManager.instance.uiManager.inspector; IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
Inspector inspectorMain = EditorManager.instance.uiManager.inspector; Inspector inspectorMain = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Track Renderer Auto Orient"); var container = inspector.GenerateContainer("Track Renderer " + submoduleName[submoduleNameIndex]);
var zWriteSettings = container.GenerateSubcontainer(3); var zWriteSettings = container.GenerateSubcontainer(3);
var zWriteToggle = var zWriteToggle =
inspector.GenerateToggle(this, zWriteSettings, "Enable ZWrite", nameof(zWrite)) inspector.GenerateToggle(this, zWriteSettings, "Enable ZWrite", nameof(zWrite))
.AddListenerFunction(SetEnableZWrite); .AddListenerFunction(SetEnableZWrite);
@@ -99,7 +103,7 @@ namespace Ichni.RhythmGame
var emissionIntensityInputField = var emissionIntensityInputField =
inspector.GenerateInputField(this, emissionSettings, "Emission Intensity", nameof(emissionIntensity)) inspector.GenerateInputField(this, emissionSettings, "Emission Intensity", nameof(emissionIntensity))
.AddListenerFunction(SetEmissionIntensity); .AddListenerFunction(SetEmissionIntensity);
var materialSettings = container.GenerateSubcontainer(3); var materialSettings = container.GenerateSubcontainer(3);
var themeBundleDropdown = inspector var themeBundleDropdown = inspector
.GenerateDropdown(this, materialSettings, "Theme Bundle", ThemeBundleManager.instance.selectedThemeBundleList, nameof(materialThemeBundleName)) .GenerateDropdown(this, materialSettings, "Theme Bundle", ThemeBundleManager.instance.selectedThemeBundleList, nameof(materialThemeBundleName))
@@ -132,12 +136,12 @@ namespace Ichni.RhythmGame
{ {
meshRenderer.material.SetInt("_Emission", enableEmission ? 1 : 0); meshRenderer.material.SetInt("_Emission", enableEmission ? 1 : 0);
} }
protected void SetEnableZWrite() protected void SetEnableZWrite()
{ {
meshRenderer.material.SetInt("_ZWrite", zWrite ? 1 : 0); meshRenderer.material.SetInt("_ZWrite", zWrite ? 1 : 0);
} }
protected void SetEmissionIntensity() protected void SetEmissionIntensity()
{ {
meshRenderer.material.SetColor("_EmissionColor", Color.white * Mathf.Pow(2, emissionIntensity)); meshRenderer.material.SetColor("_EmissionColor", Color.white * Mathf.Pow(2, emissionIntensity));
@@ -164,6 +168,7 @@ namespace Ichni.RhythmGame
this.meshRenderer.material = renderMaterial; this.meshRenderer.material = renderMaterial;
this.splineRenderer.color = Color.white; this.splineRenderer.color = Color.white;
this.splineRenderer.uvRotation = 90; this.splineRenderer.uvRotation = 90;
this.submoduleNameIndex = 0; // Auto Orient is the first submodule
} }
public override void SaveBM() public override void SaveBM()
@@ -194,6 +199,7 @@ namespace Ichni.RhythmGame
materialName = trackRendererSubmodule.materialName; materialName = trackRendererSubmodule.materialName;
enableEmission = trackRendererSubmodule.enableEmission; enableEmission = trackRendererSubmodule.enableEmission;
emissionIntensity = trackRendererSubmodule.emissionIntensity; emissionIntensity = trackRendererSubmodule.emissionIntensity;
} }
public override void ExecuteBM() public override void ExecuteBM()
@@ -241,6 +247,7 @@ namespace Ichni.RhythmGame
this.meshRenderer.material = renderMaterial; this.meshRenderer.material = renderMaterial;
this.pathGenerator.color = Color.white; this.pathGenerator.color = Color.white;
this.pathGenerator.uvRotation = 90; this.pathGenerator.uvRotation = 90;
this.submoduleNameIndex = 1; // Path Generator is the second submodule
} }
public override void SaveBM() public override void SaveBM()
@@ -305,7 +312,7 @@ namespace Ichni.RhythmGame
public TubeGenerator tubeGenerator; public TubeGenerator tubeGenerator;
public int sideCount; public int sideCount;
public TrackRendererSubmoduleTubeGenerator(Track track, bool enableEmission, float emissionIntensity, bool zWrite, public TrackRendererSubmoduleTubeGenerator(Track track, bool enableEmission, float emissionIntensity, bool zWrite,
int sideCount, Material material = null) : int sideCount, Material material = null) :
base(track, enableEmission, emissionIntensity, zWrite) base(track, enableEmission, emissionIntensity, zWrite)
{ {
@@ -323,6 +330,7 @@ namespace Ichni.RhythmGame
this.tubeGenerator.color = Color.white; this.tubeGenerator.color = Color.white;
this.tubeGenerator.uvRotation = 90; this.tubeGenerator.uvRotation = 90;
this.tubeGenerator.sides = sideCount; this.tubeGenerator.sides = sideCount;
this.submoduleNameIndex = 2; // Tube Generator is the third submodule
} }
public override void SaveBM() public override void SaveBM()
@@ -349,6 +357,7 @@ namespace Ichni.RhythmGame
{ {
public class TrackRendererSubmoduleTubeGenerator_BM : Submodule_BM public class TrackRendererSubmoduleTubeGenerator_BM : Submodule_BM
{ {
public string materialThemeBundleName; public string materialThemeBundleName;
public string materialName; public string materialName;
public bool enableEmission; public bool enableEmission;
@@ -412,10 +421,11 @@ namespace Ichni.RhythmGame
this.surface.spline = track.trackPathSubmodule.path; this.surface.spline = track.trackPathSubmodule.path;
this.surface.clipFrom = 0; this.surface.clipFrom = 0;
this.surface.clipTo = 1; this.surface.clipTo = 1;
this.surface.updateMethod = SplineUser.UpdateMethod.LateUpdate; this.surface.updateMethod = SplineUser.UpdateMethod.Update;
this.meshRenderer.material = renderMaterial; this.meshRenderer.material = renderMaterial;
this.surface.color = Color.white; this.surface.color = Color.white;
this.surface.uvRotation = 90; this.surface.uvRotation = 90;
this.submoduleNameIndex = 3; // Surface is the fourth submodule
} }
public override void SaveBM() public override void SaveBM()

View File

@@ -147,7 +147,7 @@ public class SampleWindow : MovableWindow//该window高度为300横的要在1
TransformChanged(); TransformChanged();
windowRect.GetComponent<CanvasGroup>().alpha = track.timeDurationSubmodule.CheckTimeInDuration(songTime) ? 1f : 0.2f; windowRect.GetComponent<CanvasGroup>().alpha = track.timeDurationSubmodule.CheckTimeInDuration(songTime) ? 1f : 0.2f;
} }
if (selectedGameObject.GetType() != typeof(TMP_InputField) && RectTransformUtility.RectangleContainsScreenPoint(windowRect, Mouse.current.position.ReadValue())) if (RectTransformUtility.RectangleContainsScreenPoint(windowRect, Mouse.current.position.ReadValue()))
{ {
DetectNote(); DetectNote();

View File

@@ -4292,8 +4292,7 @@
],"GeneralJudge":[ ],"GeneralJudge":[
{ {
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMRippleEffect_BM,Assembly-CSharp", "__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMRippleEffect_BM,Assembly-CSharp",
"isCircle" : true, "rippleTime" : 0.65,
"rippleTime" : 1,
"positionOffset" : { "positionOffset" : {
"x" : 0, "x" : 0,
"y" : 0, "y" : 0,
@@ -4305,17 +4304,17 @@
"z" : 0 "z" : 0
}, },
"scale" : { "scale" : {
"x" : 5, "x" : 1,
"y" : 5, "y" : 1,
"z" : 5 "z" : 1
}, },
"emissionColor" : { "emissionColor" : {
"r" : 1, "r" : 0.3576441,
"g" : 1, "g" : 0.7463304,
"b" : 1, "b" : 0.8065491,
"a" : 1 "a" : 1
}, },
"emissionIntensity" : 0, "emissionIntensity" : 2,
"effectTime" : 0 "effectTime" : 0
} }
],"StartHold":[ ],"StartHold":[
@@ -4633,7 +4632,33 @@
"effectTime" : 0.2 "effectTime" : 0.2
} }
],"GeneralJudge":[ ],"GeneralJudge":[
{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMRippleEffect_BM,Assembly-CSharp",
"rippleTime" : 0.65,
"positionOffset" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"eulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"scale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"emissionColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionIntensity" : 0,
"effectTime" : 0
}
],"StartHold":[ ],"StartHold":[
],"Holding":[ ],"Holding":[
@@ -69805,6 +69830,118 @@
"attachedElementGuid" : { "attachedElementGuid" : {
"value" : "5f34a959-75c8-4df9-bff4-47c2b9d90b30" "value" : "5f34a959-75c8-4df9-bff4-47c2b9d90b30"
} }
},{
"__type" : "Ichni.RhythmGame.Beatmap.ElementFolder_BM,Assembly-CSharp",
"elementName" : "New Folder",
"tags" : [
],
"elementGuid" : {
"value" : "f033da76-2827-498e-a8f4-82dfbad97b19"
},
"attachedElementGuid" : {
"value" : "00000000-0000-0000-0000-000000000000"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "f033da76-2827-498e-a8f4-82dfbad97b19"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeDurationSubmodule_BM,Assembly-CSharp",
"isOverridingDuration" : false,
"startTime" : -32767,
"endTime" : 32767,
"attachedElementGuid" : {
"value" : "f033da76-2827-498e-a8f4-82dfbad97b19"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TimeEffectsCollection_BM,Assembly-CSharp",
"time" : 4,
"elementName" : "New Time Effects Collection",
"tags" : [
],
"elementGuid" : {
"value" : "71249fe3-f96a-4905-939b-55b2f5bf49b4"
},
"attachedElementGuid" : {
"value" : "f033da76-2827-498e-a8f4-82dfbad97b19"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.TransformSubmodule_BM,Assembly-CSharp",
"originalPosition" : {
"x" : 0,
"y" : 0,
"z" : 10
},
"originalEulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"originalScale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"attachedElementGuid" : {
"value" : "71249fe3-f96a-4905-939b-55b2f5bf49b4"
}
},{
"__type" : "Ichni.RhythmGame.Beatmap.EffectSubmodule_BM,Assembly-CSharp",
"effectCollection" : {"Prior":[
],"Default":[
{
"__type" : "Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap.DTMRippleEffect_BM,Assembly-CSharp",
"rippleTime" : 0.65,
"positionOffset" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"eulerAngles" : {
"x" : 0,
"y" : 0,
"z" : 0
},
"scale" : {
"x" : 1,
"y" : 1,
"z" : 1
},
"emissionColor" : {
"r" : 1,
"g" : 1,
"b" : 1,
"a" : 1
},
"emissionIntensity" : 0,
"effectTime" : 0
}
],"Late":[
]
},
"attachedElementGuid" : {
"value" : "71249fe3-f96a-4905-939b-55b2f5bf49b4"
}
} }
], ],
"attachedElementGuid" : { "attachedElementGuid" : {