Vector3 inputfield 改进
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using TMPro;
|
||||
using UnityEngine;
|
||||
|
||||
@@ -9,17 +10,18 @@ namespace Ichni.Editor
|
||||
{
|
||||
public TMP_InputField inputField;
|
||||
|
||||
public override void Initialize(string title, string parameterName)
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(title, parameterName);
|
||||
inputField.text = connectedGameElement.GetType().GetField(parameterName).GetValue(connectedGameElement).ToString(); //获取对应变量的值
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
inputField.text = connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement).ToString(); //获取对应变量的值
|
||||
|
||||
inputField.onEndEdit.AddListener(ApplyParameters); //输入结束后修改变量
|
||||
inputField.onEndEdit.AddListener(ApplyParameters);
|
||||
}
|
||||
|
||||
private void ApplyParameters(string text)
|
||||
{
|
||||
connectedGameElement.GetType().GetField(parameterName).SetValue(connectedGameElement, text);
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, text);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user