83 lines
2.1 KiB
C#
83 lines
2.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using Ichni;
|
|
using Ichni.Editor;
|
|
using Ichni.RhythmGame;
|
|
using TMPro;
|
|
using UnityEditor;
|
|
using UnityEngine;
|
|
|
|
public class TimelineTab : MonoBehaviour
|
|
{
|
|
public TMP_Text Title;
|
|
public IBaseElement connectedElement;
|
|
|
|
public SubTab ElementPrefab;
|
|
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(IBaseElement element, Type DisplayType)
|
|
{
|
|
connectedElement = element;
|
|
Title.text = DisplayType.ToString().Split('.').Last();
|
|
|
|
AddElement(element);
|
|
}
|
|
public void AddElement(IBaseElement gameElement)
|
|
{
|
|
if (gameElement == null)
|
|
{
|
|
return;
|
|
}
|
|
GelementPointer.Add(gameElement);
|
|
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;
|
|
|
|
if (SubTabs.ContainsKey(Judgetime))
|
|
{
|
|
SubTabs[Judgetime].Set(gameElement, Judgetime);
|
|
}
|
|
else
|
|
{
|
|
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;
|
|
}
|
|
|
|
}
|