烂尾
timeline居然没看懂,那个点击估计得重写 这种要怎么侦测呀
This commit is contained in:
@@ -18,7 +18,24 @@ namespace Ichni.Editor
|
||||
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);
|
||||
return tab;
|
||||
}
|
||||
public void FindTab(GameElement targetElement, bool findparent = false)
|
||||
{
|
||||
if (targetElement.connectedTab != null)
|
||||
{
|
||||
targetElement.connectedTab.tabButton.onClick.Invoke();
|
||||
}
|
||||
else
|
||||
{
|
||||
FindTab(targetElement.parentElement, true);
|
||||
}
|
||||
|
||||
if (findparent && targetElement.connectedTab != null)
|
||||
{
|
||||
targetElement.connectedTab.expandButton.onClick.Invoke();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -87,7 +87,7 @@ namespace Ichni.Editor
|
||||
return c;
|
||||
}
|
||||
|
||||
private void SelectGameElement()
|
||||
public void SelectGameElement()
|
||||
{
|
||||
EditorManager.instance.operationManager.SelectElement(connectedGameElement);
|
||||
EditorManager.instance.uiManager.inspector.SetInspector(connectedGameElement);
|
||||
@@ -134,6 +134,7 @@ namespace Ichni.Editor
|
||||
{
|
||||
parentTab.childTabList.Remove(this);
|
||||
Destroy(gameObject);
|
||||
EditorManager.instance.uiManager.hierarchy.tabList.Remove(this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
46
Assets/Scripts/DynamicUI/Timeline/SubTab.cs
Normal file
46
Assets/Scripts/DynamicUI/Timeline/SubTab.cs
Normal file
@@ -0,0 +1,46 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class SubTab : MonoBehaviour
|
||||
{
|
||||
public List<GameElement> connectObj = new();
|
||||
public Button button;
|
||||
//private SongInformation songInformation = EditorManager.instance.songInformation;
|
||||
private TimePointerModule timePointerModule;
|
||||
private Timeline timeline;
|
||||
public float Time;
|
||||
public void Set(GameElement Objs, float time)
|
||||
{
|
||||
timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule;
|
||||
timeline = EditorManager.instance.uiManager.timeline;
|
||||
Time = time;
|
||||
connectObj.Add(Objs);
|
||||
button.GetComponentInChildren<TMP_Text>().text = connectObj.Count().ToString();
|
||||
}
|
||||
public void Update()
|
||||
{
|
||||
|
||||
|
||||
Vector3 newPOs = B2P(Time);
|
||||
transform.position = newPOs;
|
||||
}
|
||||
|
||||
public void GetClick()
|
||||
{
|
||||
EditorManager.instance.uiManager.hierarchy.FindTab(connectObj[0]);
|
||||
}
|
||||
|
||||
|
||||
public Vector3 B2P(float Time)
|
||||
{
|
||||
Vector3 i = new(Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 15f - timePointerModule.delayDistanceOffset + 150, transform.position.y, 0);
|
||||
return i;
|
||||
}
|
||||
}
|
||||
11
Assets/Scripts/DynamicUI/Timeline/SubTab.cs.meta
Normal file
11
Assets/Scripts/DynamicUI/Timeline/SubTab.cs.meta
Normal file
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8aff442fe127d534ba6f0236328cff84
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -24,7 +24,8 @@ namespace Ichni.Editor
|
||||
public float intervalUnit;
|
||||
public float timePointerInterval;
|
||||
public float sizeNegative, sizePositive;
|
||||
public int negativePointerAmount, positivePointerAmount, totalPointerAmount;
|
||||
public int negativePointerAmount; // 负方向指示线的数量
|
||||
public int positivePointerAmount, totalPointerAmount;
|
||||
/// <summary>
|
||||
/// delay时间区间中,(-delay, 0)的距离偏移量
|
||||
/// </summary>
|
||||
@@ -71,9 +72,12 @@ namespace Ichni.Editor
|
||||
intervalUnit = (60f / bpm) / beatDivider * 1000;
|
||||
|
||||
sizeNegative = delay * beatDivider / timeline.timePerBeat;
|
||||
|
||||
// 计算负方向指示线的数量
|
||||
negativePointerAmount = Mathf.CeilToInt(sizeNegative);
|
||||
|
||||
sizePositive = songInformation.song.length * beatDivider / timeline.timePerBeat;
|
||||
|
||||
negativePointerAmount = Mathf.CeilToInt(sizeNegative);
|
||||
positivePointerAmount = Mathf.CeilToInt(sizePositive);
|
||||
|
||||
totalPointerAmount = negativePointerAmount + positivePointerAmount;
|
||||
@@ -143,9 +147,13 @@ namespace Ichni.Editor
|
||||
/// </summary>
|
||||
public void UpdatePointers()
|
||||
{
|
||||
// 计算延迟距离偏移量
|
||||
delayDistanceOffset = timePointerInterval * (negativePointerAmount - sizeNegative);
|
||||
|
||||
// 更新指示线区域的大小
|
||||
timePointerArea.sizeDelta = new Vector2(timePointerInterval * totalPointerAmount, 55f);
|
||||
|
||||
// 更新每个指示线的位置
|
||||
foreach (var pointer in timePointerList)
|
||||
{
|
||||
pointer.GetComponent<RectTransform>().anchoredPosition =
|
||||
|
||||
@@ -33,6 +33,7 @@ namespace Ichni.Editor
|
||||
public void Update()
|
||||
{
|
||||
if (musicPlayer.isPlaying) UpdateTime();
|
||||
|
||||
if (RectTransformUtility.RectangleContainsScreenPoint(GetinputArea, Mouse.current.position.ReadValue()))
|
||||
{
|
||||
|
||||
@@ -112,8 +113,35 @@ namespace Ichni.Editor
|
||||
public Dictionary<Type, TimelineTab> timelineTabList = new Dictionary<Type, TimelineTab>();
|
||||
public void SetTimeLine(GameElement element)
|
||||
{
|
||||
//在做了
|
||||
for (int i = timelineTabList.Count - 1; i >= 0; i--)
|
||||
{
|
||||
Destroy(timelineTabList.ElementAt(i).Value.gameObject);
|
||||
timelineTabList.Remove(timelineTabList.ElementAt(i).Key);
|
||||
}
|
||||
if (element is Track) Trackfind(element);
|
||||
|
||||
|
||||
}
|
||||
public void Trackfind(GameElement Track)
|
||||
{
|
||||
foreach (var i in Track.childElementList)
|
||||
{
|
||||
if (i is NoteBase)
|
||||
{
|
||||
if (!timelineTabList.ContainsKey(i.GetType()))
|
||||
{
|
||||
TimelineTab timelineTab = Instantiate(timelineTabPrefab, timelineTabRect.transform);
|
||||
|
||||
timelineTab.SetTab(i, i.GetType());
|
||||
timelineTabList.Add(i.GetType(), timelineTab);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
timelineTabList[i.GetType()].AddElement(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,15 +9,34 @@ public class TimelineTab : MonoBehaviour
|
||||
{
|
||||
public TMP_Text Title;
|
||||
public GameElement connectedGameElement;
|
||||
|
||||
public SubTab ElementPrefab;
|
||||
public List<GameElement> GelementPointer;
|
||||
|
||||
public Dictionary<float, SubTab> SubTabs = new();
|
||||
public void SetTab(GameElement element, Type DisplayType)
|
||||
{
|
||||
connectedGameElement = element;
|
||||
Title.text = DisplayType.ToString();
|
||||
foreach (var i in element.childElementList) if (i.GetType() == DisplayType) GelementPointer.Add(i);
|
||||
|
||||
AddElement(element);
|
||||
}
|
||||
public void AddElement(GameElement gameElement)
|
||||
{
|
||||
|
||||
GelementPointer.Add(gameElement);
|
||||
if (gameElement is NoteBase)
|
||||
{
|
||||
float Judgetime = ((NoteBase)gameElement).exactJudgeTime;
|
||||
print(Judgetime);
|
||||
|
||||
if (SubTabs.ContainsKey(Judgetime)) SubTabs[Judgetime].Set(gameElement, Judgetime);
|
||||
else
|
||||
{
|
||||
SubTab i = Instantiate(ElementPrefab, transform);
|
||||
i.Set(gameElement, Judgetime);
|
||||
SubTabs.Add(Judgetime, i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user