暂存:动画曲线
还没搞完,复制粘贴也没有
This commit is contained in:
@@ -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