Gradient
This commit is contained in:
@@ -0,0 +1,36 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIGradientAlphaKeyUnit : DynamicUICompositeUnit
|
||||
{
|
||||
public TMP_InputField colorAInputField;
|
||||
public TMP_InputField percentInputField;
|
||||
|
||||
public override void SetUnit(CompositeParameterWindow window, object itemContent)
|
||||
{
|
||||
compositeParameterWindow = window;
|
||||
|
||||
GradientAlphaKey alphaKey = (GradientAlphaKey)itemContent;
|
||||
colorAInputField.text = alphaKey.alpha.ToString();
|
||||
percentInputField.text = alphaKey.time.ToString();
|
||||
|
||||
colorAInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
percentInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
|
||||
removeButton.onClick.AddListener(() =>
|
||||
{
|
||||
compositeParameterWindow.RemoveUnit(this);
|
||||
compositeParameterWindow.ApplyParameters();
|
||||
});
|
||||
}
|
||||
|
||||
public GradientAlphaKey GetValue()
|
||||
{
|
||||
return new GradientAlphaKey(float.Parse(colorAInputField.text), float.Parse(percentInputField.text));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user