From dfa136eb3a4fac7c18e273743fe98551a0df3e4d Mon Sep 17 00:00:00 2001 From: TRAfoer Date: Fri, 21 Feb 2025 21:12:57 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=91=E9=9C=80=E8=A6=81=E5=B8=AE=E5=8A=A9?= =?UTF-8?q?=F0=9F=98=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit timeline下面的子菜单不知道怎么适配比例 还有性能不是很好(TimeLineTabS)下面的一坨 --- Assets/Scripts/DynamicUI/Timeline/SubTab.cs | 27 +++++++++++-------- .../DynamicUI/Timeline/TimePointerModule.cs | 3 ++- Assets/Scripts/DynamicUI/Timeline/Timeline.cs | 3 ++- .../Scripts/DynamicUI/Timeline/TimelineTab.cs | 1 + 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/Assets/Scripts/DynamicUI/Timeline/SubTab.cs b/Assets/Scripts/DynamicUI/Timeline/SubTab.cs index 4c613268..bec34a6a 100644 --- a/Assets/Scripts/DynamicUI/Timeline/SubTab.cs +++ b/Assets/Scripts/DynamicUI/Timeline/SubTab.cs @@ -12,12 +12,13 @@ public class SubTab : MonoBehaviour { public List connectObj = new(); public Button button; - //private SongInformation songInformation = EditorManager.instance.songInformation; + private SongInformation songInformation; private TimePointerModule timePointerModule; private Timeline timeline; public float Time; public void Set(GameElement Objs, float time) { + songInformation = EditorManager.instance.songInformation; timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule; timeline = EditorManager.instance.uiManager.timeline; Time = time; @@ -26,10 +27,20 @@ public class SubTab : MonoBehaviour } public void Update() { - - - Vector3 newPOs = B2P(Time); - transform.position = newPOs; + if (Time - timePointerModule.leftSideSongTime < 0) + { + transform.localScale = Vector3.zero; + return; + } + else + { + transform.localScale = Vector3.one; + float devideTime = Time - timePointerModule.leftSideSongTime; + transform.position = new Vector3( + devideTime / timeline.timePerBeat * timePointerModule.timePointerInterval + 165f - timePointerModule.delayDistanceOffset + , transform.position.y, 0 + ); + } } public void GetClick() @@ -37,10 +48,4 @@ public class SubTab : MonoBehaviour EditorManager.instance.uiManager.hierarchy.FindTab(connectObj[0]); } - - public Vector3 B2P(float Time) - { - Vector3 i = new(Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 15f - timePointerModule.delayDistanceOffset + 150, transform.position.y, 0); - return i; - } } diff --git a/Assets/Scripts/DynamicUI/Timeline/TimePointerModule.cs b/Assets/Scripts/DynamicUI/Timeline/TimePointerModule.cs index a7ec1320..e65c3918 100644 --- a/Assets/Scripts/DynamicUI/Timeline/TimePointerModule.cs +++ b/Assets/Scripts/DynamicUI/Timeline/TimePointerModule.cs @@ -112,7 +112,7 @@ namespace Ichni.Editor timePointerArea.anchoredPosition = new Vector2((timePointerArea.sizeDelta.x / 2) - - ((startTime + songInformation.delay) / timeline.timePerBeat) * timePointerInterval, 0); + (startTime + songInformation.delay) / timeline.timePerBeat * timePointerInterval, 0); float proportion = mainTimePointer.anchoredPosition.x / visibleTimePointerArea.rect.width; @@ -125,6 +125,7 @@ namespace Ichni.Editor /// /// 细分X分音符 /// + private void CreatePointer(int beatDivider, int index) { TimePointer pointer = Instantiate(timePointerPrefab, timePointerArea).GetComponent(); diff --git a/Assets/Scripts/DynamicUI/Timeline/Timeline.cs b/Assets/Scripts/DynamicUI/Timeline/Timeline.cs index 6ddcd31d..080785ce 100644 --- a/Assets/Scripts/DynamicUI/Timeline/Timeline.cs +++ b/Assets/Scripts/DynamicUI/Timeline/Timeline.cs @@ -123,7 +123,7 @@ namespace Ichni.Editor } public void Trackfind(GameElement Track) - { + {//这也是if山 foreach (var i in Track.childElementList) { if (i is NoteBase) @@ -134,6 +134,7 @@ namespace Ichni.Editor timelineTab.SetTab(i, i.GetType()); timelineTabList.Add(i.GetType(), timelineTab); + } else { diff --git a/Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs b/Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs index 20da4e8a..28917f11 100644 --- a/Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs +++ b/Assets/Scripts/DynamicUI/Timeline/TimelineTab.cs @@ -34,6 +34,7 @@ public class TimelineTab : MonoBehaviour else { SubTab i = Instantiate(ElementPrefab, transform); + i.Set(gameElement, Judgetime); SubTabs.Add(Judgetime, i); }