三种动画参数的Composite Unit
This commit is contained in:
@@ -1,18 +1,54 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
|
||||
public class DynamicUIAnimatedFloatUnit : MonoBehaviour
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
public class DynamicUIAnimatedFloatUnit : DynamicUICompositeUnit
|
||||
{
|
||||
public TMP_InputField startTimeInputField;
|
||||
public TMP_InputField endTimeInputField;
|
||||
public TMP_InputField startValueInputField;
|
||||
public TMP_InputField endValueInputField;
|
||||
public TMP_Dropdown animationCurveTypeDropdown;
|
||||
|
||||
}
|
||||
public override void SetUnit(CompositeParameterWindow window, object itemContent)
|
||||
{
|
||||
compositeParameterWindow = window;
|
||||
|
||||
AnimatedFloat animatedFloat = (AnimatedFloat)itemContent;
|
||||
startTimeInputField.text = animatedFloat.startTime.ToString();
|
||||
endTimeInputField.text = animatedFloat.endTime.ToString();
|
||||
startValueInputField.text = animatedFloat.startValue.ToString();
|
||||
endValueInputField.text = animatedFloat.endValue.ToString();
|
||||
animationCurveTypeDropdown.ClearOptions();
|
||||
List<string> enumNameList = System.Enum.GetNames(typeof(AnimationCurveType)).ToList();
|
||||
animationCurveTypeDropdown.AddOptions(enumNameList);
|
||||
animationCurveTypeDropdown.value = (int)animatedFloat.animationCurveType;
|
||||
|
||||
|
||||
startTimeInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
endTimeInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
startValueInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
endValueInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
animationCurveTypeDropdown.onValueChanged.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
|
||||
removeButton.onClick.AddListener(() =>
|
||||
{
|
||||
compositeParameterWindow.RemoveUnit(this);
|
||||
compositeParameterWindow.ApplyParameters();
|
||||
});
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
public AnimatedFloat GetValue()
|
||||
{
|
||||
return new AnimatedFloat(float.Parse(startTimeInputField.text), float.Parse(endTimeInputField.text),
|
||||
float.Parse(startValueInputField.text), float.Parse(endValueInputField.text),
|
||||
(AnimationCurveType)animationCurveTypeDropdown.value);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user