暂存:动画曲线

还没搞完,复制粘贴也没有
This commit is contained in:
2025-03-01 16:18:19 +08:00
parent 191be59c3d
commit ded6f14d06
15 changed files with 1228 additions and 117 deletions

View File

@@ -4,6 +4,7 @@ using System.Linq;
using Ichni;
using Ichni.Editor;
using Ichni.RhythmGame;
using MoreMountains.Tools;
using TMPro;
using UnityEngine;
using UnityEngine.UI;
@@ -14,7 +15,7 @@ public class SubTab : MonoBehaviour
public Button button;
private SongInformation songInformation;
private TimePointerModule timePointerModule;
public TimelineTab timelineTab;
public TimelineTab father;
private Timeline timeline;
public float Time;
public void Set(GameElement Objs, float time)
@@ -25,32 +26,14 @@ public class SubTab : MonoBehaviour
Time = time;
connectObj.Add(Objs);
button.GetComponentInChildren<TMP_Text>().text = connectObj.Count().ToString();
transform.localPosition = new Vector3(
timelineTab.MoveArea.localPosition.x + (time / timeline.timePerBeat * timePointerModule.timePointerInterval)
, transform.localPosition.y, 0
);
transform.position = new Vector3(0, father.transform.position.y, 0);
transform.localPosition = new Vector3(Time / timeline.timePerBeat * timePointerModule.timePointerInterval + 15f - timePointerModule.delayDistanceOffset, 0, 0);
}
// public void Update()
// {
// 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()
{
EditorManager.instance.uiManager.hierarchy.FindTab(connectObj[0]);
}
}

View File

@@ -1,5 +1,6 @@
using System.Collections;
using System.Collections.Generic;
using Sirenix.OdinInspector;
using TMPro;
using UniRx;
using UnityEngine;
@@ -11,5 +12,20 @@ namespace Ichni.Editor
public TMP_Text intervalUnitText;
public float time;
public int index;
// [Title("poss")]
// public Vector3 position;
// public Vector3 localPosition;
// public Vector3 anchoredPosition;
// public Vector3 anchoredPosition3D;
// public void Update()
// {
// position = this.transform.position;
// localPosition = this.transform.localPosition;
// anchoredPosition = this.GetComponent<RectTransform>().anchoredPosition;
// anchoredPosition3D = this.GetComponent<RectTransform>().anchoredPosition3D;
// }
}
}

View File

@@ -18,7 +18,7 @@ namespace Ichni.Editor
public RectTransform timePointerArea;
public RectTransform visibleTimePointerArea;
public RectTransform moveTabPoint;//用于显示timeline上的tab
public RectTransform mainTimePointer;
public float intervalUnit;
@@ -47,13 +47,28 @@ namespace Ichni.Editor
if (EditorManager.instance.musicPlayer.isPlaying)
{
SetRange(songInformation.songTime);
}
moveTabPoint.localPosition = new Vector3(timePointerArea.localPosition.x + OnePointer.transform.localPosition.x - timePointerInterval, -45f, 0);
timePointerList.ForEach(pointer =>
{
bool isActive = pointer.time >= leftSideSongTime && pointer.time <= rightSideSongTime;
pointer.gameObject.SetActive(isActive);
});
foreach (var i in moveTabPoint.transform.GetComponentsInChildren<SubTab>())
{
if (i.Time >= songInformation.songTime)
{
i.transform.localScale = new Vector3(1, 1, 1);
}
else
{
i.transform.localScale = new Vector3(0, 0, 0);
}
}
}
/// <summary>
@@ -124,7 +139,7 @@ namespace Ichni.Editor
/// </summary>
/// <param name="beatDivider">细分X分音符</param>
/// <param name="index"></param>
TimePointer OnePointer = null;
private void CreatePointer(int beatDivider, int index)
{
TimePointer pointer = Instantiate(timePointerPrefab, timePointerArea).GetComponent<TimePointer>();
@@ -136,6 +151,10 @@ namespace Ichni.Editor
pointer.time = index * intervalUnit / 1000f;
pointer.intervalUnitText.text = Mathf.RoundToInt(index * intervalUnit).ToString();
if (index == 0)
{
OnePointer = timePointerList[timePointerList.Count - 1];
}
if (beatDivider > 1)
{

View File

@@ -110,19 +110,26 @@ namespace Ichni.Editor
{
public TimelineTab timelineTabPrefab;
public Dictionary<Type, TimelineTab> timelineTabList = new Dictionary<Type, TimelineTab>();
public void SetTimeLine(GameElement element)
public void SetTimeLine(GameElement element)//暂时好了(别的类型什么的传时间就好了)
{
for (int i = timePointerModule.moveTabPoint.childCount - 1; i >= 0; i--)
{
var transform = timePointerModule.moveTabPoint.transform.GetChild(i);
Destroy(transform.gameObject);
}
for (int i = timelineTabList.Count - 1; i >= 0; i--)
{
Destroy(timelineTabList.ElementAt(i).Value.gameObject);
timelineTabList.Remove(timelineTabList.ElementAt(i).Key);
}
print(1);
if (element is Track) Trackfind(element);
Notefind(element);
}
public void Trackfind(GameElement Track)
public RectTransform moveTabPoint;
public void Notefind(GameElement Track)
{//这也是if山
foreach (var i in Track.childElementList)
{
@@ -133,6 +140,7 @@ namespace Ichni.Editor
TimelineTab timelineTab = Instantiate(timelineTabPrefab, timelineTabRect.transform);
//timelineTab.timeline = this;
//timelineTab.MoveArea = timePointerModule.timePointerArea;
timelineTab.MoveArea = moveTabPoint;
timelineTab.SetTab(i, i.GetType());
timelineTabList.Add(i.GetType(), timelineTab);

View File

@@ -41,7 +41,7 @@ public class TimelineTab : MonoBehaviour
else
{
SubTab i = Instantiate(ElementPrefab, MoveArea.transform);
i.timelineTab = this;
i.father = this;
i.Set(gameElement, Judgetime);
SubTabs.Add(Judgetime, i);
}
@@ -51,11 +51,5 @@ public class TimelineTab : MonoBehaviour
{
timeline = EditorManager.instance.uiManager.timeline;
}
public void Update()
{
MoveArea.position = new Vector3(
-(timeline.songTime / timeline.timePerBeat) * timeline.timePointerModule.timePointerInterval,
MoveArea.position.y,
MoveArea.position.z);
}
}