奇怪的调
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using DG.Tweening;
|
||||
using Ichni.RhythmGame;
|
||||
using Michsky.MUIP;
|
||||
using Sirenix.Utilities;
|
||||
@@ -83,7 +84,8 @@ namespace Ichni.Editor
|
||||
}
|
||||
public void SetStatus()
|
||||
{
|
||||
expandButton.interactable = !connectedGameElement.childElementList.IsNullOrEmpty();
|
||||
//expandButton.interactable = !connectedGameElement.childElementList.IsNullOrEmpty();
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -124,20 +126,18 @@ namespace Ichni.Editor
|
||||
EditorManager.instance.timeline.SetTimeLine(connectedGameElement);
|
||||
}
|
||||
|
||||
private void ExpandOrFold()
|
||||
public void ExpandOrFold()
|
||||
{
|
||||
this.childTabList.RemoveAll(s => s == null);
|
||||
isExpanded = !isExpanded;
|
||||
StartCoroutine(ExpandAnim());
|
||||
ExpandAnim();
|
||||
if (isExpanded)
|
||||
{
|
||||
float startTime = Time.realtimeSinceStartup;
|
||||
connectedGameElement.childElementList.Sort();//TODO: 后续可以让玩家手动快速排序
|
||||
Debug.Log("排序耗时 " + (Time.realtimeSinceStartup - startTime).ToString());
|
||||
StartCoroutine(ExpandOverTime());
|
||||
|
||||
for (var index = 0; index < connectedGameElement.childElementList.Count; index++)
|
||||
{
|
||||
var childElement = connectedGameElement.childElementList[index];
|
||||
EditorManager.instance.uiManager.hierarchy.GenerateTab(childElement, connectedGameElement);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -167,16 +167,25 @@ namespace Ichni.Editor
|
||||
EditorManager.instance.uiManager.hierarchy.tabList.Remove(this);
|
||||
}
|
||||
}
|
||||
private IEnumerator ExpandAnim()
|
||||
private void ExpandAnim()
|
||||
{
|
||||
expandButton.transform.DORotate(new Vector3(0, 0, !isExpanded ? 0f : 180f), 0.2f);
|
||||
}
|
||||
private IEnumerator ExpandOverTime()//帧率过低的时候等一下再实例化
|
||||
{
|
||||
|
||||
for (int i = 0; i < 10; i++)
|
||||
float startTime = Time.realtimeSinceStartup;
|
||||
for (var index = 0; index < connectedGameElement.childElementList.Count; index++)
|
||||
{
|
||||
expandButton.transform.GetComponentInChildren<TMP_Text>().rectTransform.localRotation =
|
||||
Quaternion.Euler(0, 0, isExpanded ? 18 * i : 180 - 18 * i);
|
||||
yield return null;
|
||||
int hasYield = 0;
|
||||
while (Time.realtimeSinceStartup - startTime > 1f / EditorManager.instance.editorSettings.frameRate * 3f && hasYield <= 2)
|
||||
{
|
||||
yield return null;
|
||||
hasYield += 1;
|
||||
}
|
||||
var childElement = connectedGameElement.childElementList[index];
|
||||
EditorManager.instance.uiManager.hierarchy.GenerateTab(childElement, connectedGameElement);
|
||||
}
|
||||
expandButton.transform.GetComponentInChildren<TMP_Text>().rectTransform.localRotation = Quaternion.Euler(0, 0, isExpanded ? 180 : 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user