我需要帮助😭

timeline下面的子菜单不知道怎么适配比例
还有性能不是很好(TimeLineTabS)下面的一坨
This commit is contained in:
2025-02-21 21:12:57 +08:00
parent 65992750b0
commit dfa136eb3a
4 changed files with 21 additions and 13 deletions

View File

@@ -12,12 +12,13 @@ public class SubTab : MonoBehaviour
{
public List<GameElement> 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;
}
}

View File

@@ -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
/// </summary>
/// <param name="beatDivider">细分X分音符</param>
/// <param name="index"></param>
private void CreatePointer(int beatDivider, int index)
{
TimePointer pointer = Instantiate(timePointerPrefab, timePointerArea).GetComponent<TimePointer>();

View File

@@ -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
{

View File

@@ -34,6 +34,7 @@ public class TimelineTab : MonoBehaviour
else
{
SubTab i = Instantiate(ElementPrefab, transform);
i.Set(gameElement, Judgetime);
SubTabs.Add(Judgetime, i);
}