制作点击添加组件然后出现bug
This commit is contained in:
@@ -1,7 +1,9 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
@@ -21,6 +23,7 @@ public class EventPoint : MonoBehaviour
|
||||
public RawImage CurveCanvas;
|
||||
public RawImage CurveCanvas2;
|
||||
public FlexibleFloatTab FatherTab;
|
||||
|
||||
public int BeatDeviver => FatherTab.BeatDeviver;
|
||||
public void Initialize(AnimatedFloat animatedFloat)
|
||||
{
|
||||
@@ -39,12 +42,13 @@ public class EventPoint : MonoBehaviour
|
||||
|
||||
|
||||
|
||||
//记得
|
||||
CurveCanvas2.rectTransform.sizeDelta = new Vector2(NextEventPoint.transform.localPosition.x - RightSide.sizeDelta.x, EvDrawimage.rectTransform.sizeDelta.y + 50);
|
||||
|
||||
ReDraw(FatherTab.scalevalue);
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
public float value => FatherTab.scalevalue;
|
||||
public void ReDraw(float value)
|
||||
{
|
||||
Texture2D Texture = new Texture2D((int)CurveCanvas.rectTransform.sizeDelta.x / 5, (int)CurveCanvas.rectTransform.sizeDelta.y / 5);
|
||||
@@ -59,14 +63,82 @@ public class EventPoint : MonoBehaviour
|
||||
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);//丑陋
|
||||
int f = (int)(
|
||||
(Texture.height / 2) + (animatedFloat.startValue * value + ((animatedFloat.endValue - animatedFloat.startValue)
|
||||
* AnimationCurveEvaluator.Evaluate(animatedFloat.animationCurveType, t) * value))
|
||||
);
|
||||
if (f < Texture.height) Texture.SetPixel(i, f, Color.green);//丑陋
|
||||
else Texture.SetPixel(i, f, Color.red);
|
||||
}
|
||||
Texture.Apply();
|
||||
CurveCanvas.texture = Texture;
|
||||
if (NextEventPoint != null)
|
||||
{
|
||||
OvDrawimage.transform.localPosition = new Vector3(RightSide.transform.localPosition.x, animatedFloat.endValue * value * 5, 0);
|
||||
OvDrawimage.rectTransform.sizeDelta = new Vector2((NextEventPoint.animatedFloat.startTime - animatedFloat.endTime) / EditorManager.instance.uiManager.timeline.timePerBeat * FatherTab.BeatDeviver, OvDrawimage.rectTransform.sizeDelta.y);
|
||||
|
||||
OvDrawimage.color = new Color(0, 1, 0, 1);
|
||||
while (OvDrawimage.transform.localPosition.y > 130)
|
||||
{
|
||||
OvDrawimage.color = new Color(1, 0, 0, 0.3f);
|
||||
OvDrawimage.transform.localPosition = new Vector3(OvDrawimage.transform.localPosition.x, OvDrawimage.transform.localPosition.y - 260, OvDrawimage.transform.localPosition.z);
|
||||
}
|
||||
while (OvDrawimage.transform.localPosition.y < -130)
|
||||
{
|
||||
OvDrawimage.color = new Color(1, 0, 0, 0.3f);
|
||||
OvDrawimage.transform.localPosition = new Vector3(OvDrawimage.transform.localPosition.x, OvDrawimage.transform.localPosition.y + 260, OvDrawimage.transform.localPosition.z);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
OvDrawimage.rectTransform.sizeDelta = new Vector2(0, OvDrawimage.rectTransform.sizeDelta.y
|
||||
);
|
||||
}
|
||||
|
||||
selectButton.transform.localPosition = EvDrawimage.transform.localPosition;
|
||||
selectButton.GetComponent<RectTransform>().sizeDelta = EvDrawimage.rectTransform.sizeDelta;
|
||||
}
|
||||
|
||||
public void UpLoad()
|
||||
{
|
||||
if (FatherTab.FatherWindow.ConnectedPoint == this)
|
||||
{
|
||||
FatherTab.FatherWindow.VisibleArea.SetActive(false);
|
||||
FatherTab.FatherWindow.ConnectedPoint = null;
|
||||
EvDrawimage.color = new Color(
|
||||
EvDrawimage.color.r,
|
||||
0.3019607843137255f,
|
||||
EvDrawimage.color.b, 0.5f
|
||||
);
|
||||
FatherTab.FatherWindow.StartText.text = "";
|
||||
FatherTab.FatherWindow.EndText.text = "";
|
||||
FatherTab.FatherWindow.StartValueText.text = "";
|
||||
FatherTab.FatherWindow.EndValueText.text = "";
|
||||
return;
|
||||
}
|
||||
if (FatherTab.FatherWindow.ConnectedPoint != null)
|
||||
{
|
||||
|
||||
FatherTab.FatherWindow.ConnectedPoint.EvDrawimage.color = new Color(
|
||||
FatherTab.FatherWindow.ConnectedPoint.EvDrawimage.color.r,
|
||||
0.3019607843137255f,
|
||||
FatherTab.FatherWindow.ConnectedPoint.EvDrawimage.color.b, 0.5f)
|
||||
;
|
||||
}
|
||||
List<string> enumNameList = System.Enum.GetNames(typeof(AnimationCurveType)).ToList();
|
||||
FatherTab.FatherWindow.VisibleArea.SetActive(true);
|
||||
FatherTab.FatherWindow.animationCurveTypeDropdown.ClearOptions();
|
||||
FatherTab.FatherWindow.animationCurveTypeDropdown.AddOptions(enumNameList);
|
||||
FatherTab.FatherWindow.animationCurveTypeDropdown.value = (int)animatedFloat.animationCurveType;
|
||||
FatherTab.FatherWindow.ConnectedPoint = this;
|
||||
EvDrawimage.color = new Color(
|
||||
EvDrawimage.color.r,
|
||||
0.75f,
|
||||
EvDrawimage.color.b,
|
||||
1f);
|
||||
FatherTab.FatherWindow.StartText.text = animatedFloat.startTime.ToString();
|
||||
FatherTab.FatherWindow.EndText.text = animatedFloat.endTime.ToString();
|
||||
FatherTab.FatherWindow.StartValueText.text = animatedFloat.startValue.ToString();
|
||||
FatherTab.FatherWindow.EndValueText.text = animatedFloat.endValue.ToString();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user