Timeline's Note And Sth Submodule
This commit is contained in:
@@ -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