所有Simple UI Element,以及Composite Parameter Window初步
This commit is contained in:
@@ -0,0 +1,26 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
public class DynamicUIToggle : DynamicUIElement
|
||||
{
|
||||
public Toggle toggle;
|
||||
|
||||
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
|
||||
{
|
||||
base.Initialize(baseElement, title, parameterName);
|
||||
toggle.isOn = (bool)connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement); //获取对应变量的值
|
||||
toggle.onValueChanged.AddListener(ApplyParameters);
|
||||
}
|
||||
|
||||
private void ApplyParameters(bool value)
|
||||
{
|
||||
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
|
||||
connectedBaseElement.Refresh();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user