暂存:动画曲线
还没搞完,复制粘贴也没有
This commit is contained in:
@@ -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]);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
// }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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)
|
||||
{
|
||||
|
||||
|
||||
@@ -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);
|
||||
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -14,10 +14,12 @@ public class EventPoint : MonoBehaviour
|
||||
public Image EvDrawimage;
|
||||
public Image OvDrawimage;
|
||||
|
||||
|
||||
public RectTransform LeftSide;
|
||||
public RectTransform RightSide;
|
||||
public Button selectButton;
|
||||
|
||||
public RawImage CurveCanvas;
|
||||
public RawImage CurveCanvas2;
|
||||
public FlexibleFloatTab FatherTab;
|
||||
public int BeatDeviver => FatherTab.BeatDeviver;
|
||||
public void Initialize(AnimatedFloat animatedFloat)
|
||||
@@ -29,19 +31,42 @@ public class EventPoint : MonoBehaviour
|
||||
RightSide.localPosition = new Vector3(
|
||||
(animatedFloat.endTime - animatedFloat.startTime) / EditorManager.instance.timeline.timePerBeat * BeatDeviver, 0, 0);
|
||||
|
||||
EvDrawimage.rectTransform.sizeDelta = new Vector2(RightSide.localPosition.x - transform.localPosition.x, EvDrawimage.rectTransform.sizeDelta.y);
|
||||
EvDrawimage.rectTransform.sizeDelta = new Vector2(RightSide.localPosition.x - LeftSide.localPosition.x, EvDrawimage.rectTransform.sizeDelta.y);
|
||||
EvDrawimage.transform.localPosition = new Vector3(EvDrawimage.rectTransform.sizeDelta.x / 2, 0, 0);
|
||||
OvDrawimage.transform.localPosition = RightSide.localPosition;
|
||||
CurveCanvas.transform.localPosition = EvDrawimage.transform.localPosition;
|
||||
CurveCanvas.rectTransform.sizeDelta = new Vector2(EvDrawimage.rectTransform.sizeDelta.x, EvDrawimage.rectTransform.sizeDelta.y + 50);
|
||||
|
||||
|
||||
|
||||
ReDraw();
|
||||
//记得
|
||||
CurveCanvas2.rectTransform.sizeDelta = new Vector2(NextEventPoint.transform.localPosition.x - RightSide.sizeDelta.x, EvDrawimage.rectTransform.sizeDelta.y + 50);
|
||||
|
||||
ReDraw(FatherTab.scalevalue);
|
||||
}
|
||||
|
||||
private void ReDraw()
|
||||
public void ReDraw(float value)
|
||||
{
|
||||
|
||||
|
||||
Texture2D Texture = new Texture2D((int)CurveCanvas.rectTransform.sizeDelta.x / 5, (int)CurveCanvas.rectTransform.sizeDelta.y / 5);
|
||||
for (int i = 0; i < Texture.width; i++)
|
||||
{
|
||||
for (int j = 0; j < Texture.height; j++)
|
||||
{
|
||||
Texture.SetPixel(i, j, new Color(0, 0, 0, 0));
|
||||
}
|
||||
}
|
||||
Texture.Apply();
|
||||
for (int i = 0; i < Texture.width; i++)
|
||||
{
|
||||
float t = (float)i / Texture.width;
|
||||
Texture.SetPixel(i,
|
||||
(int)(
|
||||
(Texture.height / 2) + ((animatedFloat.endValue - animatedFloat.startValue)
|
||||
* AnimationCurveEvaluator.Evaluate(animatedFloat.animationCurveType, t) * value)
|
||||
), Color.green);//丑陋
|
||||
}
|
||||
Texture.Apply();
|
||||
CurveCanvas.texture = Texture;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,7 +3,10 @@ using System.Collections.Generic;
|
||||
using System.Data;
|
||||
using Ichni;
|
||||
using Ichni.RhythmGame;
|
||||
using Unity.VisualScripting;
|
||||
using UnityEngine;
|
||||
using UnityEngine.InputSystem;
|
||||
|
||||
|
||||
public class FlexibleFloatTab : MonoBehaviour
|
||||
{
|
||||
@@ -52,5 +55,31 @@ public class FlexibleFloatTab : MonoBehaviour
|
||||
|
||||
Area.localPosition = new Vector3(-FatherWindow.songBeat * BeatDeviver, 0, 0);
|
||||
BeatArea.localPosition = Area.localPosition;
|
||||
CheckForAddEvent();
|
||||
}
|
||||
|
||||
private void CheckForAddEvent()
|
||||
{
|
||||
if (Keyboard.current.rKey.wasPressedThisFrame && RectTransformUtility.RectangleContainsScreenPoint(Area, Mouse.current.position.ReadValue()))
|
||||
{
|
||||
AddEvent();
|
||||
}
|
||||
}
|
||||
|
||||
private void AddEvent()
|
||||
{
|
||||
print(1);
|
||||
}
|
||||
|
||||
|
||||
|
||||
public float scalevalue => FatherWindow.scalevalue;
|
||||
public void CurveScale(float value)
|
||||
{
|
||||
foreach (EventPoint i in eventPoints)
|
||||
{
|
||||
i.ReDraw(value);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -26,6 +26,7 @@ public class GraphicalFlexibleFloatWindow : MovableWindow
|
||||
public int BeatDeviver = 100;
|
||||
public void Initialize(IBaseElement baseElement, string title, FlexibleFloat[] FlexibleFloats, string[] Subtitles)
|
||||
{
|
||||
scalevalue = 5;
|
||||
transform.localScale = Vector3.zero;
|
||||
this.connectedBaseElement = baseElement;
|
||||
this.title.text = title;
|
||||
@@ -68,4 +69,14 @@ public class GraphicalFlexibleFloatWindow : MovableWindow
|
||||
//StartCoroutine(WindowAnim.HidePanel(gameObject, true));
|
||||
Destroy(gameObject);
|
||||
}
|
||||
public float scalevalue;
|
||||
public void CurveScale(string Rawvalue)
|
||||
{
|
||||
float value = float.Parse(Rawvalue);
|
||||
scalevalue = value;
|
||||
foreach (FlexibleFloatTab i in unitList)
|
||||
{
|
||||
i.CurveScale(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user