变量模块;Element启用控制
This commit is contained in:
@@ -0,0 +1,35 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIStringIntPairUnit : DynamicUICompositeUnit
|
||||
{
|
||||
public TMP_InputField keyInputField, valueInputField;
|
||||
|
||||
public override void SetUnit(CompositeParameterWindow window, object itemContent)
|
||||
{
|
||||
var pair = (KeyValuePair<string, int>) itemContent;
|
||||
compositeParameterWindow = window;
|
||||
|
||||
keyInputField.text = pair.Key;
|
||||
valueInputField.text = pair.Value.ToString();
|
||||
|
||||
keyInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
valueInputField.onEndEdit.AddListener(_ => compositeParameterWindow.ApplyParameters());
|
||||
|
||||
removeButton.onClick.AddListener(() =>
|
||||
{
|
||||
compositeParameterWindow.RemoveUnit(this);
|
||||
compositeParameterWindow.ApplyParameters();
|
||||
});
|
||||
}
|
||||
|
||||
public KeyValuePair<string, int> GetValue()
|
||||
{
|
||||
return new KeyValuePair<string, int>(keyInputField.text, int.Parse(valueInputField.text));
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user