Vector3 inputfield 改进

This commit is contained in:
SoulliesOfficial
2025-02-12 18:46:46 -05:00
parent 3a1ee5f9ef
commit 8d03acc3cb
30 changed files with 1781 additions and 239 deletions

View File

@@ -0,0 +1,35 @@
using System;
using System.Collections;
using System.Collections.Generic;
using System.Linq;
using Ichni.RhythmGame;
using TMPro;
using UnityEngine;
namespace Ichni.Editor
{
public class DynamicUIDropdown : DynamicUIElement
{
public TMP_Dropdown dropdown;
public override void Initialize(IBaseElement baseElement, string title, string parameterName)
{
base.Initialize(baseElement, title, parameterName);
dropdown.value = (int)connectedBaseElement.GetType().GetField(parameterName).GetValue(connectedBaseElement); //获取对应变量的值
dropdown.onValueChanged.AddListener(ApplyParameters);
}
public void SetUpEnum(Type enumType)
{
dropdown.options.Clear();
List<string> enumNameList = System.Enum.GetNames(enumType).ToList();
dropdown.AddOptions(enumNameList);
}
private void ApplyParameters(int value)
{
connectedBaseElement.GetType().GetField(parameterName).SetValue(connectedBaseElement, value);
connectedBaseElement.Refresh();
}
}
}