列表输入二级界面扩展List<float>,特效单元扩展
This commit is contained in:
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
using UnityEngine.Serialization;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIInputFieldUnit : DynamicUICompositeUnit
|
||||
{
|
||||
[FormerlySerializedAs("stringInputField")]
|
||||
public TMP_InputField inputField;
|
||||
|
||||
public override void SetUnit(CompositeParameterWindow window, object itemContent)
|
||||
{
|
||||
compositeParameterWindow = window;
|
||||
inputField.text = itemContent.ToString();
|
||||
inputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
removeButton.onClick.AddListener(() =>
|
||||
{
|
||||
compositeParameterWindow.RemoveUnit(this);
|
||||
compositeParameterWindow.ApplyParameters();
|
||||
});
|
||||
}
|
||||
|
||||
public T GetValue<T>()
|
||||
{
|
||||
return (T)Convert.ChangeType(inputField.text, typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user