38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame;
|
|
using TMPro;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
namespace Ichni.Editor
|
|
{
|
|
public class DynamicUIAnimatedBoolUnit : DynamicUICompositeUnit
|
|
{
|
|
public TMP_InputField timeInputField;
|
|
public Toggle valueToggle;
|
|
|
|
public override void SetUnit(CompositeParameterWindow window, object itemContent)
|
|
{
|
|
compositeParameterWindow = window;
|
|
|
|
AnimatedBool animatedBool = (AnimatedBool)itemContent;
|
|
timeInputField.text = animatedBool.time.ToString();
|
|
valueToggle.isOn = animatedBool.value;
|
|
|
|
timeInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
|
valueToggle.onValueChanged.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
|
|
|
removeButton.onClick.AddListener(() =>
|
|
{
|
|
compositeParameterWindow.RemoveUnit(this);
|
|
compositeParameterWindow.ApplyParameters();
|
|
});
|
|
}
|
|
|
|
public AnimatedBool GetValue()
|
|
{
|
|
return new AnimatedBool(float.Parse(timeInputField.text), valueToggle.isOn);
|
|
}
|
|
}
|
|
} |