using Convention.WindowsUI; using TMPro; using UnityEngine; namespace Demo.Editor { public class BPMLine : MonoBehaviour { private UnityEngine.UI.Text MyText; private UnityEngine.UI.Image MyView; private RectTransform MyRectTransform; private void Awake() { MyText = GetComponentInChildren(); MyRectTransform = GetComponent(); MyView = GetComponent(); } public void Setup(float time, float currentTime, float onebar,float farAlpha, Vector2 clip) { gameObject.SetActive(true); var t = (time - clip.x) / (clip.y - clip.x); if (Mathf.Abs(time - currentTime) < 4 * onebar) { MyText.gameObject.SetActive(true); MyText.text = time.ToString(); MyView.color = new(1, 1, 1, 1); } else { MyText.gameObject.SetActive(false); MyView.color = new(1, 1, 1, farAlpha); } MyRectTransform.anchorMin = new(t, 0); MyRectTransform.anchorMax = new(t, 1); } } }