Files
ichni_Creator_Studio/Assets/Scripts/DynamicUI/Timeline/SubTab.cs
TRAfoer eeecba5a3e 体验优化
Signed-off-by: TRAfoer <lhf190@outlook.com>
2025-07-19 13:52:42 +08:00

67 lines
2.4 KiB
C#

using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni;
using Ichni.Editor;
using Ichni.RhythmGame;
using MoreMountains.Tools;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
public class SubTab : MonoBehaviour
{
public List<IBaseElement> connectObj = new();
public Button button;
private SongInformation songInformation;
private TimePointerModule timePointerModule;
public TimelineTab father;
private Timeline timeline;
public RawImage ProgressImage;
public RectTransform anotherTab;//Last
public float time;
public void Set(IBaseElement Objs, float time, RectTransform anotherTab = null)
{
songInformation = EditorManager.instance.songInformation;
timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule;
timeline = EditorManager.instance.uiManager.timeline;
this.time = time;
connectObj.Add(Objs);
button.GetComponentInChildren<TMP_Text>().text = connectObj.Count().ToString();
if (anotherTab != null)
{
this.anotherTab = anotherTab;
ProgressImage.GetComponent<RectTransform>().sizeDelta = new Vector2((time - anotherTab.GetComponent<SubTab>().time) / timeline.timePerBeat * timePointerModule.timePointerInterval, ProgressImage.GetComponent<RectTransform>().sizeDelta.y);
button.GetComponentInChildren<TMP_Text>().text = "E";
anotherTab.GetComponent<SubTab>().button.GetComponentInChildren<TMP_Text>().text = "S";
}
transform.localPosition = new Vector3((this.time / timeline.timePerBeat * timePointerModule.timePointerInterval),
-(42.5f + ((father.TabIndex + 1) * 25)), 0);
//transform.position = new Vector3(transform.position.x, father.Title.transform.position.y + 12, 0);
button.onClick.AddListener(GetClick);
}
void Update()
{
if (Time.frameCount % 3 == 0)
{
transform.localScale = new Vector3(time > songInformation.songTime ? 1f : 0f, 1f, 1f);
}
}
public void GetClick()//?
{
if (connectObj[0] is GameElement)
{
EditorManager.instance.uiManager.hierarchy.FindTab((GameElement)connectObj[0]);
}
else
{
EditorManager.instance.uiManager.hierarchy.FindTab(((SubmoduleBase)connectObj[0]).attachedGameElement);
}
}
}