自定义曲线编辑器, Trail界面跟进
This commit is contained in:
@@ -0,0 +1,45 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUICustomCurveKeyframeUnit : DynamicUICompositeUnit
|
||||
{
|
||||
public TMP_InputField timeInputField;
|
||||
public TMP_InputField valueInputField;
|
||||
public TMP_InputField inTangentInputField;
|
||||
public TMP_InputField outTangentInputField;
|
||||
|
||||
public override void SetUnit(CompositeParameterWindow window, object itemContent)
|
||||
{
|
||||
compositeParameterWindow = window;
|
||||
|
||||
Keyframe keyframe = (Keyframe)itemContent;
|
||||
timeInputField.text = keyframe.time.ToString();
|
||||
valueInputField.text = keyframe.value.ToString();
|
||||
inTangentInputField.text = keyframe.inTangent.ToString();
|
||||
outTangentInputField.text = keyframe.outTangent.ToString();
|
||||
|
||||
timeInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
valueInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
inTangentInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
outTangentInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
|
||||
removeButton.onClick.AddListener(() =>
|
||||
{
|
||||
compositeParameterWindow.RemoveUnit(this);
|
||||
compositeParameterWindow.ApplyParameters();
|
||||
});
|
||||
}
|
||||
|
||||
public Keyframe GetValue()
|
||||
{
|
||||
return new Keyframe(float.Parse(timeInputField.text), float.Parse(valueInputField.text),
|
||||
float.Parse(inTangentInputField.text), float.Parse(outTangentInputField.text));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user