2025-02-11 22:58:56 -05:00
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
2025-02-12 18:46:46 -05:00
|
|
|
using Ichni.RhythmGame;
|
2025-02-11 22:58:56 -05:00
|
|
|
using TMPro;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Ichni.Editor
|
|
|
|
|
{
|
|
|
|
|
public class DynamicUIInputField : DynamicUIElement
|
|
|
|
|
{
|
|
|
|
|
public TMP_InputField inputField;
|
|
|
|
|
|
2025-02-12 18:46:46 -05:00
|
|
|
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
2025-02-11 22:58:56 -05:00
|
|
|
{
|
2025-02-12 18:46:46 -05:00
|
|
|
base.Initialize(baseElement, title, parameterName);
|
|
|
|
|
inputField.text = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement).ToString(); //获取对应变量的值
|
2025-02-12 17:57:26 +08:00
|
|
|
|
2025-02-12 18:46:46 -05:00
|
|
|
inputField.onEndEdit.AddListener(ApplyParameters);
|
2025-02-11 22:58:56 -05:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ApplyParameters(string text)
|
|
|
|
|
{
|
2025-02-12 18:46:46 -05:00
|
|
|
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
|
|
|
|
connectedBaseElement.Refresh();
|
2025-02-11 22:58:56 -05:00
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|