我需要帮助😭

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 List<GameElement> connectObj = new();
public Button button; public Button button;
//private SongInformation songInformation = EditorManager.instance.songInformation; private SongInformation songInformation;
private TimePointerModule timePointerModule; private TimePointerModule timePointerModule;
private Timeline timeline; private Timeline timeline;
public float Time; public float Time;
public void Set(GameElement Objs, float time) public void Set(GameElement Objs, float time)
{ {
songInformation = EditorManager.instance.songInformation;
timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule; timePointerModule = EditorManager.instance.uiManager.timeline.timePointerModule;
timeline = EditorManager.instance.uiManager.timeline; timeline = EditorManager.instance.uiManager.timeline;
Time = time; Time = time;
@@ -26,10 +27,20 @@ public class SubTab : MonoBehaviour
} }
public void Update() public void Update()
{ {
if (Time - timePointerModule.leftSideSongTime < 0)
{
Vector3 newPOs = B2P(Time); transform.localScale = Vector3.zero;
transform.position = newPOs; 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() public void GetClick()
@@ -37,10 +48,4 @@ public class SubTab : MonoBehaviour
EditorManager.instance.uiManager.hierarchy.FindTab(connectObj[0]); 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 = timePointerArea.anchoredPosition =
new Vector2((timePointerArea.sizeDelta.x / 2) - 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; float proportion = mainTimePointer.anchoredPosition.x / visibleTimePointerArea.rect.width;
@@ -125,6 +125,7 @@ namespace Ichni.Editor
/// </summary> /// </summary>
/// <param name="beatDivider">细分X分音符</param> /// <param name="beatDivider">细分X分音符</param>
/// <param name="index"></param> /// <param name="index"></param>
private void CreatePointer(int beatDivider, int index) private void CreatePointer(int beatDivider, int index)
{ {
TimePointer pointer = Instantiate(timePointerPrefab, timePointerArea).GetComponent<TimePointer>(); TimePointer pointer = Instantiate(timePointerPrefab, timePointerArea).GetComponent<TimePointer>();

View File

@@ -123,7 +123,7 @@ namespace Ichni.Editor
} }
public void Trackfind(GameElement Track) public void Trackfind(GameElement Track)
{ {//这也是if山
foreach (var i in Track.childElementList) foreach (var i in Track.childElementList)
{ {
if (i is NoteBase) if (i is NoteBase)
@@ -134,6 +134,7 @@ namespace Ichni.Editor
timelineTab.SetTab(i, i.GetType()); timelineTab.SetTab(i, i.GetType());
timelineTabList.Add(i.GetType(), timelineTab); timelineTabList.Add(i.GetType(), timelineTab);
} }
else else
{ {

View File

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