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 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().text = connectObj.Count().ToString(); if (anotherTab != null) { this.anotherTab = anotherTab; ProgressImage.GetComponent().sizeDelta = new Vector2((time - anotherTab.GetComponent().time) / timeline.timePerBeat * timePointerModule.timePointerInterval, ProgressImage.GetComponent().sizeDelta.y); button.GetComponentInChildren().text = "E"; anotherTab.GetComponent().button.GetComponentInChildren().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); } } }