Timeline's Note And Sth Submodule
This commit is contained in:
@@ -31,10 +31,14 @@ namespace Ichni.Editor
|
||||
tabList.Add(tab);
|
||||
return tab;
|
||||
}
|
||||
|
||||
|
||||
public void FindTab(GameElement targetElement, bool findparent = false)
|
||||
{
|
||||
if (targetElement.connectedTab != null)
|
||||
if (findparent && targetElement.connectedTab != null)
|
||||
{
|
||||
targetElement.connectedTab.expandButton.onClick.Invoke();
|
||||
}
|
||||
else if (targetElement.connectedTab != null)
|
||||
{
|
||||
targetElement.connectedTab.tabButton.onClick.Invoke();
|
||||
}
|
||||
@@ -43,10 +47,7 @@ namespace Ichni.Editor
|
||||
FindTab(targetElement.parentElement, true);
|
||||
}
|
||||
|
||||
if (findparent && targetElement.connectedTab != null)
|
||||
{
|
||||
targetElement.connectedTab.expandButton.onClick.Invoke();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,14 +11,15 @@ using UnityEngine.UI;
|
||||
|
||||
public class SubTab : MonoBehaviour
|
||||
{
|
||||
public List<GameElement> connectObj = new();
|
||||
public List<IBaseElement> connectObj = new();
|
||||
public Button button;
|
||||
private SongInformation songInformation;
|
||||
private TimePointerModule timePointerModule;
|
||||
public TimelineTab father;
|
||||
private Timeline timeline;
|
||||
public float Time;
|
||||
public void Set(GameElement Objs, float time)
|
||||
|
||||
public void Set(IBaseElement Objs, float time)
|
||||
{
|
||||
songInformation = EditorManager.instance.songInformation;
|
||||
timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule;
|
||||
@@ -26,13 +27,22 @@ public class SubTab : MonoBehaviour
|
||||
Time = time;
|
||||
connectObj.Add(Objs);
|
||||
button.GetComponentInChildren<TMP_Text>().text = connectObj.Count().ToString();
|
||||
transform.position = new Vector3(0, father.transform.position.y, 0);
|
||||
transform.localPosition = new Vector3(Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 15f - timePointerModule.delayDistanceOffset, 0, 0);
|
||||
|
||||
transform.localPosition = new Vector3(Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 15f - timePointerModule.delayDistanceOffset,
|
||||
-(42.5f + (father.TabIndex * 25)), 0);
|
||||
//transform.position = new Vector3(transform.position.x, father.Title.transform.position.y, 0);
|
||||
}
|
||||
|
||||
public void GetClick()
|
||||
public void GetClick()//?
|
||||
{
|
||||
EditorManager.instance.uiManager.hierarchy.FindTab(connectObj[0]);
|
||||
if (connectObj[0] is GameElement)
|
||||
{
|
||||
EditorManager.instance.uiManager.hierarchy.FindTab((GameElement)connectObj[0]);
|
||||
}
|
||||
else
|
||||
{
|
||||
EditorManager.instance.uiManager.hierarchy.FindTab(((SubmoduleBase)connectObj[0]).attachedGameElement);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -56,7 +56,8 @@ namespace Ichni.Editor
|
||||
bool isActive = pointer.time >= leftSideSongTime && pointer.time <= rightSideSongTime;
|
||||
pointer.gameObject.SetActive(isActive);
|
||||
});
|
||||
if (OnePointer != null) moveTabPoint.localPosition = new Vector3(timePointerArea.localPosition.x + OnePointer.transform.localPosition.x - timePointerInterval, -45f, 0);
|
||||
if (OnePointer != null) moveTabPoint.localPosition =
|
||||
new Vector3(timePointerArea.localPosition.x + OnePointer.transform.localPosition.x - timePointerInterval, 0, 0);
|
||||
|
||||
foreach (var i in moveTabPoint.transform.GetComponentsInChildren<SubTab>())
|
||||
{
|
||||
|
||||
@@ -110,8 +110,10 @@ namespace Ichni.Editor
|
||||
{
|
||||
public TimelineTab timelineTabPrefab;
|
||||
public Dictionary<Type, TimelineTab> timelineTabList = new Dictionary<Type, TimelineTab>();
|
||||
private int TabIndex = 0;
|
||||
public void SetTimeLine(GameElement element)//暂时好了(别的类型什么的传时间就好了)
|
||||
{
|
||||
TabIndex = 0;
|
||||
for (int i = timePointerModule.moveTabPoint.childCount - 1; i >= 0; i--)
|
||||
{
|
||||
var transform = timePointerModule.moveTabPoint.transform.GetChild(i);
|
||||
@@ -123,35 +125,64 @@ namespace Ichni.Editor
|
||||
timelineTabList.Remove(timelineTabList.ElementAt(i).Key);
|
||||
}
|
||||
|
||||
Notefind(element);
|
||||
Elementfind(element);
|
||||
|
||||
|
||||
}
|
||||
|
||||
public RectTransform moveTabPoint;
|
||||
public void Notefind(GameElement Track)
|
||||
{//这也是if山
|
||||
foreach (var i in Track.childElementList)
|
||||
public void Elementfind(GameElement element)//在其中添加东西时timelineTab也要写(难受)
|
||||
{
|
||||
|
||||
if (element.submoduleList.Any(w => w is TimeDurationSubmodule))
|
||||
{
|
||||
TimeDurationSubmodule sub = (TimeDurationSubmodule)element.submoduleList.Find(w => w is TimeDurationSubmodule);
|
||||
if (sub.isOverridingDuration) Add(sub);
|
||||
}
|
||||
|
||||
if (element is NoteBase)
|
||||
{
|
||||
if (!timelineTabList.ContainsKey(element.GetType()))
|
||||
{
|
||||
Add(element);
|
||||
}
|
||||
else
|
||||
{
|
||||
timelineTabList[element.GetType()].AddElement(element);
|
||||
}
|
||||
}
|
||||
else if (element is Track track && track.submoduleList.Any(w => w is TrackTimeSubmodule))
|
||||
{
|
||||
TrackTimeSubmodule sub = (TrackTimeSubmodule)track.submoduleList.Find(w => w is TrackTimeSubmodule);
|
||||
Add(sub);
|
||||
}
|
||||
|
||||
foreach (var i in element.childElementList)
|
||||
{
|
||||
if (i is NoteBase)
|
||||
{
|
||||
if (!timelineTabList.ContainsKey(i.GetType()))
|
||||
{
|
||||
TimelineTab timelineTab = Instantiate(timelineTabPrefab, timelineTabRect.transform);
|
||||
//timelineTab.timeline = this;
|
||||
//timelineTab.MoveArea = timePointerModule.timePointerArea;
|
||||
timelineTab.MoveArea = moveTabPoint;
|
||||
timelineTab.SetTab(i, i.GetType());
|
||||
timelineTabList.Add(i.GetType(), timelineTab);
|
||||
|
||||
Add(i);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
timelineTabList[i.GetType()].AddElement(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
private void Add(IBaseElement obj)
|
||||
{
|
||||
TimelineTab timelineTab = Instantiate(timelineTabPrefab, timelineTabRect.transform);
|
||||
timelineTab.MoveArea = moveTabPoint;
|
||||
timelineTab.TabIndex = TabIndex;
|
||||
timelineTab.SetTab(obj, obj.GetType());
|
||||
timelineTabList.Add(obj.GetType(), timelineTab);
|
||||
|
||||
TabIndex++;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,7 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni;
|
||||
using Ichni.Editor;
|
||||
using Ichni.RhythmGame;
|
||||
@@ -11,42 +12,69 @@ using UnityEngine;
|
||||
public class TimelineTab : MonoBehaviour
|
||||
{
|
||||
public TMP_Text Title;
|
||||
public GameElement connectedGameElement;
|
||||
public IBaseElement connectedElement;
|
||||
|
||||
public SubTab ElementPrefab;
|
||||
public List<GameElement> GelementPointer;
|
||||
public List<IBaseElement> GelementPointer = new();
|
||||
|
||||
public RectTransform MoveArea;
|
||||
public RectTransform title;
|
||||
public Dictionary<float, SubTab> SubTabs = new();
|
||||
|
||||
public int TabIndex;
|
||||
public Timeline timeline;
|
||||
public void SetTab(GameElement element, Type DisplayType)
|
||||
public void SetTab(IBaseElement element, Type DisplayType)
|
||||
{
|
||||
connectedGameElement = element;
|
||||
Title.text = DisplayType.ToString();
|
||||
connectedElement = element;
|
||||
Title.text = DisplayType.ToString().Split('.').Last();
|
||||
|
||||
AddElement(element);
|
||||
}
|
||||
public void AddElement(GameElement gameElement)
|
||||
public void AddElement(IBaseElement gameElement)
|
||||
{
|
||||
|
||||
if (gameElement == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
GelementPointer.Add(gameElement);
|
||||
if (gameElement is NoteBase)
|
||||
if (gameElement is TimeDurationSubmodule suba)
|
||||
{
|
||||
|
||||
AddSubTab(suba, suba.startTime);
|
||||
AddSubTab(suba, suba.endTime);
|
||||
}
|
||||
else if (gameElement is TrackTimeSubmodule sub)
|
||||
{
|
||||
if (sub is TrackTimeSubmoduleMovable moveable)
|
||||
{
|
||||
AddSubTab(moveable, moveable.trackStartTime);
|
||||
AddSubTab(moveable, moveable.trackEndTime);
|
||||
}
|
||||
}
|
||||
else if (gameElement is NoteBase)
|
||||
{
|
||||
float Judgetime = ((NoteBase)gameElement).exactJudgeTime;
|
||||
print(Judgetime);
|
||||
|
||||
if (SubTabs.ContainsKey(Judgetime)) SubTabs[Judgetime].Set(gameElement, Judgetime);
|
||||
if (SubTabs.ContainsKey(Judgetime))
|
||||
{
|
||||
SubTabs[Judgetime].Set(gameElement, Judgetime);
|
||||
}
|
||||
else
|
||||
{
|
||||
SubTab i = Instantiate(ElementPrefab, MoveArea.transform);
|
||||
i.father = this;
|
||||
i.Set(gameElement, Judgetime);
|
||||
SubTabs.Add(Judgetime, i);
|
||||
AddSubTab(gameElement, Judgetime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void AddSubTab(IBaseElement element, float time)
|
||||
{
|
||||
SubTab subTab = Instantiate(ElementPrefab, MoveArea.transform);
|
||||
subTab.father = this;
|
||||
subTab.Set(element, time);
|
||||
SubTabs.Add(time, subTab);
|
||||
|
||||
}
|
||||
|
||||
private void Start()
|
||||
{
|
||||
timeline = EditorManager.instance.uiManager.timeline;
|
||||
|
||||
Reference in New Issue
Block a user