2025-03-20 19:30:42 -04:00
|
|
|
|
using System;
|
2025-02-21 01:03:01 -05:00
|
|
|
|
using System.Collections;
|
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using Ichni;
|
|
|
|
|
|
using Ichni.Editor;
|
|
|
|
|
|
using Ichni.RhythmGame;
|
2026-03-22 12:05:32 -04:00
|
|
|
|
using Lean.Pool;
|
2025-02-21 01:03:01 -05:00
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
using UnityEngine.Events;
|
2025-05-01 22:54:56 +08:00
|
|
|
|
using UnityEngine.Profiling;
|
2026-02-11 01:26:10 +08:00
|
|
|
|
using UnityEngine.UI;
|
2025-03-20 19:30:42 -04:00
|
|
|
|
using Object = UnityEngine.Object;
|
2025-02-21 01:03:01 -05:00
|
|
|
|
|
|
|
|
|
|
namespace Ichni.Editor
|
|
|
|
|
|
{
|
2026-06-09 01:43:55 -04:00
|
|
|
|
/// <summary>
|
|
|
|
|
|
/// Inspector 工厂接口 —— 提供底层 UI 控件的实例化方法。
|
|
|
|
|
|
/// 外部代码应通过 <see cref="InspectorBuilder"/> 构建 Inspector,
|
|
|
|
|
|
/// 而非直接调用本接口的 Generate 方法。
|
|
|
|
|
|
/// </summary>
|
2025-02-21 01:03:01 -05:00
|
|
|
|
public interface IHaveInspection
|
|
|
|
|
|
{
|
|
|
|
|
|
public RectTransform WindowRect { get; set; }
|
|
|
|
|
|
public List<DynamicUIContainer> Containers { get; set; }
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public Dictionary<string, DynamicUISubcontainer> MarkedSubcontainers { get; set; }
|
2025-03-20 02:42:10 -04:00
|
|
|
|
public Dictionary<string, DynamicUIElement> MarkedElements { get; set; }
|
2025-02-21 01:03:01 -05:00
|
|
|
|
|
|
|
|
|
|
public CompositeParameterWindow GenerateCompositeParameterWindow(IBaseElement baseElement, string title,
|
|
|
|
|
|
string parameterName)
|
|
|
|
|
|
{
|
|
|
|
|
|
CompositeParameterWindow compositeParameterWindow =
|
|
|
|
|
|
Object.Instantiate(EditorManager.instance.basePrefabs.compositeParameterWindow,
|
2025-08-31 15:27:02 +08:00
|
|
|
|
EditorManager.instance.uiManager.WindowsCanvas.GetComponent<RectTransform>())
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<CompositeParameterWindow>();
|
|
|
|
|
|
compositeParameterWindow.Initialize(baseElement, title, parameterName);
|
|
|
|
|
|
return compositeParameterWindow;
|
|
|
|
|
|
}
|
2025-03-01 01:20:40 +08:00
|
|
|
|
public GraphicalFlexibleFloatWindow GenerateGraphicalFlexibleFloatWindow(IBaseElement baseElement, string title, FlexibleFloat[] FlexibleFloats, string[] subTitle)
|
|
|
|
|
|
{
|
2025-08-31 15:27:02 +08:00
|
|
|
|
GraphicalFlexibleFloatWindow graphicalFlexibleFloatWindow = Object.Instantiate(EditorManager.instance.basePrefabs.graphicalFlexibleFloatWindow, EditorManager.instance.uiManager.WindowsCanvas.GetComponent<RectTransform>())
|
2025-03-01 01:20:40 +08:00
|
|
|
|
.GetComponent<GraphicalFlexibleFloatWindow>();
|
|
|
|
|
|
graphicalFlexibleFloatWindow.Initialize(baseElement, title, FlexibleFloats, subTitle);
|
|
|
|
|
|
return graphicalFlexibleFloatWindow;
|
|
|
|
|
|
}
|
2025-05-01 22:54:56 +08:00
|
|
|
|
public SampleWindow GenerateSampler(GameElement baseElement, string title)
|
|
|
|
|
|
{
|
2025-08-31 15:27:02 +08:00
|
|
|
|
SampleWindow sampler = Object.Instantiate(EditorManager.instance.basePrefabs.sampler, EditorManager.instance.uiManager.WindowsCanvas.GetComponent<RectTransform>())
|
2025-05-01 22:54:56 +08:00
|
|
|
|
.GetComponent<SampleWindow>();
|
|
|
|
|
|
sampler.Initialize(baseElement, title);
|
|
|
|
|
|
return sampler;
|
|
|
|
|
|
}
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIContainer GenerateContainer(string titleText)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
|
|
|
|
|
DynamicUIContainer container =
|
2026-03-22 12:05:32 -04:00
|
|
|
|
LeanPool.Spawn(EditorManager.instance.basePrefabs.dynamicUIContainer, WindowRect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIContainer>();
|
2025-04-14 17:49:47 -04:00
|
|
|
|
container.Initialize(titleText);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
Containers.Add(container);
|
|
|
|
|
|
return container;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DynamicUIContainer GenerateContainer()
|
|
|
|
|
|
{
|
|
|
|
|
|
DynamicUIContainer container =
|
2026-03-22 12:05:32 -04:00
|
|
|
|
LeanPool.Spawn(EditorManager.instance.basePrefabs.dynamicUIContainer, WindowRect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIContainer>();
|
2026-03-22 12:05:32 -04:00
|
|
|
|
// 对象池复用安全:不能 Destroy title,改为 SetActive(false)
|
|
|
|
|
|
container.title.gameObject.SetActive(false);
|
|
|
|
|
|
// 初始化内部状态(不传题目)
|
|
|
|
|
|
if (container.subcontainers == null)
|
|
|
|
|
|
container.subcontainers = new System.Collections.Generic.List<DynamicUISubcontainer>();
|
|
|
|
|
|
else
|
|
|
|
|
|
container.subcontainers.Clear();
|
|
|
|
|
|
container.gridWidth = 0;
|
|
|
|
|
|
container.gridHeight = 0;
|
2025-02-21 01:03:01 -05:00
|
|
|
|
Containers.Add(container);
|
|
|
|
|
|
return container;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIButton GenerateButton(IBaseElement baseElement, DynamicUISubcontainer subcontainer, string title,
|
|
|
|
|
|
UnityAction function)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIButton button = LeanPool.Spawn(EditorManager.instance.basePrefabs.button, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIButton>();
|
2025-04-14 17:49:47 -04:00
|
|
|
|
button.SetText(title);
|
2025-03-02 02:18:28 -05:00
|
|
|
|
button.Initialize(baseElement, title, string.Empty);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
button.ApplyFunction(function);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
button.button.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(button);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return button;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIToggle GenerateToggle(IBaseElement baseElement, DynamicUISubcontainer subcontainer, string title,
|
2026-02-13 17:40:50 +08:00
|
|
|
|
string parameterName = "")
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIToggle toggle = LeanPool.Spawn(EditorManager.instance.basePrefabs.toggle, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIToggle>();
|
|
|
|
|
|
toggle.Initialize(baseElement, title, parameterName);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
toggle.toggle.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(toggle);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return toggle;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIInputField GenerateInputField(DynamicUISubcontainer subcontainer,
|
2025-02-26 00:52:08 -05:00
|
|
|
|
string title, string defaultText = "") //不与参数绑定的InputField
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIInputField inputField = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.inputField, subcontainer.rect)
|
2025-02-26 00:52:08 -05:00
|
|
|
|
.GetComponent<DynamicUIInputField>();
|
|
|
|
|
|
inputField.Initialize(null, title, string.Empty);
|
|
|
|
|
|
inputField.SetDefaultValue(defaultText);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
inputField.inputField.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(inputField);
|
2025-02-26 00:52:08 -05:00
|
|
|
|
return inputField;
|
2025-02-21 01:03:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
2025-02-26 00:52:08 -05:00
|
|
|
|
public DynamicUIInputField GenerateInputField(IBaseElement baseElement,
|
2025-04-14 17:49:47 -04:00
|
|
|
|
DynamicUISubcontainer subcontainer, string title, string parameterName, bool isAutoUpdate = false) //与参数绑定的InputField
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIInputField inputField = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.inputField, subcontainer.rect)
|
2025-02-26 00:52:08 -05:00
|
|
|
|
.GetComponent<DynamicUIInputField>();
|
|
|
|
|
|
inputField.Initialize(baseElement, title, parameterName);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
inputField.inputField.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(inputField);
|
2025-02-26 00:52:08 -05:00
|
|
|
|
return inputField;
|
|
|
|
|
|
}
|
2025-03-01 01:20:40 +08:00
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIVector3InputField GenerateVector3InputField(DynamicUISubcontainer subcontainer, string title,
|
2025-02-26 00:52:08 -05:00
|
|
|
|
Vector3 defaultVector3 = default)
|
|
|
|
|
|
{
|
|
|
|
|
|
DynamicUIVector3InputField vector3InputField =
|
2026-03-22 12:05:32 -04:00
|
|
|
|
LeanPool.Spawn(EditorManager.instance.basePrefabs.vector3InputField, subcontainer.rect)
|
2025-02-26 00:52:08 -05:00
|
|
|
|
.GetComponent<DynamicUIVector3InputField>();
|
|
|
|
|
|
vector3InputField.Initialize(null, title, string.Empty);
|
|
|
|
|
|
vector3InputField.SetDefaultValue(defaultVector3);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
vector3InputField.inputFieldX.navigation = nav;
|
|
|
|
|
|
vector3InputField.inputFieldY.navigation = nav;
|
|
|
|
|
|
vector3InputField.inputFieldZ.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(vector3InputField);
|
2025-02-26 00:52:08 -05:00
|
|
|
|
return vector3InputField;
|
2025-02-21 01:03:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DynamicUIVector3InputField GenerateVector3InputField(IBaseElement baseElement,
|
2025-04-14 17:49:47 -04:00
|
|
|
|
DynamicUISubcontainer subcontainer, string title, string parameterName, bool isAutoUpdate = false)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
|
|
|
|
|
DynamicUIVector3InputField vector3InputField =
|
2026-03-22 12:05:32 -04:00
|
|
|
|
LeanPool.Spawn(EditorManager.instance.basePrefabs.vector3InputField, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIVector3InputField>();
|
|
|
|
|
|
vector3InputField.Initialize(baseElement, title, parameterName);
|
2025-02-26 00:52:08 -05:00
|
|
|
|
vector3InputField.SetAutoUpdate(isAutoUpdate);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
vector3InputField.inputFieldX.navigation = nav;
|
|
|
|
|
|
vector3InputField.inputFieldY.navigation = nav;
|
|
|
|
|
|
vector3InputField.inputFieldZ.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(vector3InputField);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return vector3InputField;
|
|
|
|
|
|
}
|
2025-08-31 15:27:02 +08:00
|
|
|
|
|
2025-07-15 05:00:31 -04:00
|
|
|
|
public DynamicUIVector2InputField GenerateVector2InputField(IBaseElement baseElement,
|
|
|
|
|
|
DynamicUISubcontainer subcontainer, string title, string parameterName, bool isAutoUpdate = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
DynamicUIVector2InputField vector2InputField =
|
2026-03-22 12:05:32 -04:00
|
|
|
|
LeanPool.Spawn(EditorManager.instance.basePrefabs.vector2InputField, subcontainer.rect)
|
2025-07-15 05:00:31 -04:00
|
|
|
|
.GetComponent<DynamicUIVector2InputField>();
|
|
|
|
|
|
vector2InputField.Initialize(baseElement, title, parameterName);
|
|
|
|
|
|
vector2InputField.SetAutoUpdate(isAutoUpdate);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
vector2InputField.inputFieldX.navigation = nav;
|
|
|
|
|
|
vector2InputField.inputFieldY.navigation = nav;
|
2025-07-15 05:00:31 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(vector2InputField);
|
|
|
|
|
|
return vector2InputField;
|
|
|
|
|
|
}
|
2025-02-21 01:03:01 -05:00
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIBaseColorPicker GenerateBaseColorPicker(IBaseElement baseElement, DynamicUISubcontainer subcontainer,
|
2025-02-21 01:03:01 -05:00
|
|
|
|
string title, string parameterName)
|
|
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIBaseColorPicker colorPicker = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.baseColorPicker, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIBaseColorPicker>();
|
|
|
|
|
|
colorPicker.Initialize(baseElement, title, parameterName);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
colorPicker.inputFieldBaseR.navigation = nav;
|
|
|
|
|
|
colorPicker.inputFieldBaseG.navigation = nav;
|
|
|
|
|
|
colorPicker.inputFieldBaseB.navigation = nav;
|
|
|
|
|
|
colorPicker.inputFieldBaseA.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(colorPicker);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return colorPicker;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DynamicUIEmissionColorPicker GenerateEmissionColorPicker(IBaseElement baseElement,
|
2025-04-14 17:49:47 -04:00
|
|
|
|
DynamicUISubcontainer subcontainer,
|
2025-02-21 01:03:01 -05:00
|
|
|
|
string title, string emissionEnabledName, string emissionColorName, string emissionIntensityName)
|
|
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIEmissionColorPicker colorPicker = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.emissionColorPicker, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIEmissionColorPicker>();
|
|
|
|
|
|
colorPicker.Initialize(baseElement, title, emissionEnabledName, emissionColorName, emissionIntensityName);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
colorPicker.inputFieldEmissionR.navigation = nav;
|
|
|
|
|
|
colorPicker.inputFieldEmissionG.navigation = nav;
|
|
|
|
|
|
colorPicker.inputFieldEmissionB.navigation = nav;
|
|
|
|
|
|
colorPicker.inputFieldEmissionI.navigation = nav;
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(colorPicker);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return colorPicker;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIHintText GenerateHintText(IBaseElement baseElement, DynamicUISubcontainer subcontainer,
|
2025-02-21 01:03:01 -05:00
|
|
|
|
string content)
|
|
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIHintText hintText = LeanPool.Spawn(EditorManager.instance.basePrefabs.hintText, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIHintText>();
|
|
|
|
|
|
hintText.Initialize(baseElement, string.Empty, string.Empty);
|
|
|
|
|
|
hintText.SetContent(content);
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(hintText);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return hintText;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIHintText GenerateHintText(IBaseElement baseElement, DynamicUISubcontainer subcontainer, Func<string> action)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIHintText hintText = LeanPool.Spawn(EditorManager.instance.basePrefabs.hintText, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIHintText>();
|
|
|
|
|
|
hintText.Initialize(baseElement, string.Empty, string.Empty);
|
|
|
|
|
|
hintText.SetUpdatingContent(action);
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(hintText);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return hintText;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2026-06-09 01:43:55 -04:00
|
|
|
|
[Obsolete("GenerateParameterText 已无外部调用者,请使用 InspectorBuilder.HintText() 替代。")]
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIParameterText GenerateParameterText(IBaseElement baseElement, DynamicUISubcontainer subcontainer,
|
2025-02-26 00:52:08 -05:00
|
|
|
|
string title, string parameterName, bool isAutoUpdate = false)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIParameterText parameterText = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.parameterText, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIParameterText>();
|
|
|
|
|
|
parameterText.Initialize(baseElement, title, parameterName);
|
2025-02-26 00:52:08 -05:00
|
|
|
|
parameterText.SetAutoUpdate(isAutoUpdate);
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(parameterText);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return parameterText;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIEnumDropdown GenerateDropdown(IBaseElement baseElement, DynamicUISubcontainer subcontainer,
|
2025-07-15 09:43:05 -04:00
|
|
|
|
string title, System.Type enumType, string parameterName)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIEnumDropdown enumDropdown = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.enumDropdown, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIEnumDropdown>();
|
|
|
|
|
|
enumDropdown.SetUpEnum(enumType);
|
|
|
|
|
|
enumDropdown.Initialize(baseElement, title, parameterName);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(enumDropdown);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return enumDropdown;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2025-04-14 17:49:47 -04:00
|
|
|
|
public DynamicUIStringListDropdown GenerateDropdown(IBaseElement baseElement, DynamicUISubcontainer subcontainer,
|
2025-07-15 09:43:05 -04:00
|
|
|
|
string title, List<string> stringList, string parameterName)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
DynamicUIStringListDropdown stringListDropdown = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.stringListDropdown, subcontainer.rect)
|
2025-02-21 01:03:01 -05:00
|
|
|
|
.GetComponent<DynamicUIStringListDropdown>();
|
|
|
|
|
|
stringListDropdown.SetUpStringList(stringList);
|
|
|
|
|
|
stringListDropdown.Initialize(baseElement, title, parameterName);
|
2026-02-11 01:26:10 +08:00
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
2025-04-14 17:49:47 -04:00
|
|
|
|
subcontainer.dynamicUIElements.Add(stringListDropdown);
|
2025-02-21 01:03:01 -05:00
|
|
|
|
return stringListDropdown;
|
|
|
|
|
|
}
|
2025-07-10 20:40:03 +08:00
|
|
|
|
|
|
|
|
|
|
// 新增:HSV色盘生成方法
|
|
|
|
|
|
public HsvDrawer GenerateHsvDrawer(IBaseElement baseElement, DynamicUISubcontainer subcontainer, string title, string parameterName)
|
|
|
|
|
|
{
|
2026-03-22 12:05:32 -04:00
|
|
|
|
HsvDrawer hsvDrawer = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.hsvDrawer, subcontainer.rect)
|
2025-07-10 20:40:03 +08:00
|
|
|
|
.GetComponent<HsvDrawer>();
|
|
|
|
|
|
hsvDrawer.Initialize(baseElement, title, parameterName);
|
|
|
|
|
|
subcontainer.dynamicUIElements.Add(hsvDrawer);
|
|
|
|
|
|
return hsvDrawer;
|
|
|
|
|
|
}
|
2026-05-02 21:08:13 +08:00
|
|
|
|
|
|
|
|
|
|
public DynamicUISlider GenerateSlider(DynamicUISubcontainer subcontainer,
|
|
|
|
|
|
string title, float defaultValue = 0.5f, float min = 0f, float max = 1f, bool wholeNumbers = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
DynamicUISlider slider = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.slider, subcontainer.rect)
|
|
|
|
|
|
.GetComponent<DynamicUISlider>();
|
|
|
|
|
|
slider.Initialize(null, title, string.Empty, min, max, wholeNumbers);
|
|
|
|
|
|
slider.slider.SetValueWithoutNotify(defaultValue);
|
|
|
|
|
|
subcontainer.dynamicUIElements.Add(slider);
|
|
|
|
|
|
return slider;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public DynamicUISlider GenerateSlider(IBaseElement baseElement,
|
|
|
|
|
|
DynamicUISubcontainer subcontainer, string title, string parameterName,
|
|
|
|
|
|
float min = 0f, float max = 1f, bool wholeNumbers = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
DynamicUISlider slider = LeanPool
|
|
|
|
|
|
.Spawn(EditorManager.instance.basePrefabs.slider, subcontainer.rect)
|
|
|
|
|
|
.GetComponent<DynamicUISlider>();
|
|
|
|
|
|
slider.Initialize(baseElement, title, parameterName, min, max, wholeNumbers);
|
|
|
|
|
|
var nav = new Navigation { mode = Navigation.Mode.None };
|
|
|
|
|
|
slider.slider.navigation = nav;
|
|
|
|
|
|
subcontainer.dynamicUIElements.Add(slider);
|
|
|
|
|
|
return slider;
|
|
|
|
|
|
}
|
2025-02-21 01:03:01 -05:00
|
|
|
|
}
|
|
|
|
|
|
}
|