This commit is contained in:
SoulliesOfficial
2026-06-09 01:43:55 -04:00
parent 0fb72f5bba
commit 5fc1392747
171 changed files with 30149 additions and 22331 deletions

View File

@@ -0,0 +1,37 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理 Color 类型的 Drawer。
/// 创建 DynamicUIBaseColorPicker。
/// </summary>
public class BaseColorPickerDrawer : IPropertyDrawer
{
public int DefaultSpan => 3;
public float DefaultHeight => 280f;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("baseColorPicker"), ctx.Parent);
var element = go.GetComponent<DynamicUIBaseColorPicker>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
DynamicUIElement.DisableNavigation(
element.inputFieldBaseR,
element.inputFieldBaseG,
element.inputFieldBaseB,
element.inputFieldBaseA);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f148308680f4a4b47a9d1097376ca1aa

View File

@@ -0,0 +1,40 @@
using Lean.Pool;
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 按钮 Drawer不绑定数据字段。
/// 创建 DynamicUIButton 并绑定 ButtonAction。
/// </summary>
public class ButtonDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("button"), ctx.Parent);
var element = go.GetComponent<DynamicUIButton>();
element.SetText(ctx.Label);
element.Initialize(ctx.Target, ctx.Label, string.Empty);
if (ctx.ButtonAction != null)
{
UnityAction action = () => ctx.ButtonAction();
element.ApplyFunction(action);
}
DynamicUIElement.DisableNavigation(element.button);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 23d17d2a4ce34f84a84f140f213d166c

View File

@@ -0,0 +1,40 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理带 [InspectorEmissionColor] 属性的 Color 类型的 Drawer。
/// 创建 DynamicUIEmissionColorPicker支持 Emission 开关和强度控制。
/// </summary>
public class EmissionColorPickerDrawer : IPropertyDrawer
{
public int DefaultSpan => 3;
public float DefaultHeight => 320f;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("emissionColorPicker"), ctx.Parent);
var element = go.GetComponent<DynamicUIEmissionColorPicker>();
element.Initialize(ctx.Target, ctx.Label,
ctx.EmissionEnabledName ?? "NULL",
ctx.FieldName,
ctx.EmissionIntensityName ?? "NULL");
DynamicUIElement.DisableNavigation(
element.inputFieldEmissionR,
element.inputFieldEmissionG,
element.inputFieldEmissionB,
element.inputFieldEmissionI);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 444ef9b226757004f9290d1ea11d2c60

View File

@@ -0,0 +1,49 @@
using System;
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
namespace Ichni.Editor
{
/// <summary>
/// 处理所有 Enum 类型的 Drawer。
/// 通过反射获取字段的枚举类型,创建 DynamicUIEnumDropdown。
/// </summary>
public class EnumDropdownDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("enumDropdown"), ctx.Parent);
var element = go.GetComponent<DynamicUIEnumDropdown>();
// 获取枚举类型:优先使用 DrawContext 中的 EnumTypefallback 到反射
Type enumType = ctx.EnumType;
if (enumType == null && ctx.Target != null && !string.IsNullOrEmpty(ctx.FieldName))
{
var field = ctx.Target.GetType().GetField(ctx.FieldName);
if (field != null) enumType = field.FieldType;
else
{
var prop = ctx.Target.GetType().GetProperty(ctx.FieldName);
if (prop != null) enumType = prop.PropertyType;
}
}
if (enumType != null)
{
element.SetUpEnum(enumType);
}
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 13456a684c2325341a1010f04d0dabb5

View File

@@ -0,0 +1,38 @@
using Lean.Pool;
using UnityEngine;
namespace Ichni.Editor
{
/// <summary>
/// 提示文本 Drawer支持静态文本和 Func&lt;string&gt; 动态文本。
/// 创建 DynamicUIHintText。
/// </summary>
public class HintTextDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("hintText"), ctx.Parent);
var element = go.GetComponent<DynamicUIHintText>();
element.Initialize(ctx.Target, string.Empty, string.Empty);
if (ctx.DynamicText != null)
{
element.SetUpdatingContent(ctx.DynamicText);
}
else if (ctx.StaticText != null)
{
element.SetContent(ctx.StaticText);
}
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 6437a7c7bdd1fe748b37bb0ebda0abd1

View File

@@ -0,0 +1,42 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理 float, int, string 类型的 Drawer。
/// 创建 DynamicUIInputField 并绑定反射路径。
/// </summary>
public class InputFieldDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("inputField"), ctx.Parent);
var element = go.GetComponent<DynamicUIInputField>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
DynamicUIElement.DisableNavigation(element.inputField);
if (ctx.AutoUpdate && element is IHaveAutoUpdate autoUpdate)
{
autoUpdate.SetAutoUpdate(true);
}
if (ctx.ReadOnly)
{
element.inputField.interactable = false;
}
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 00072d6a1502bc74d8b7d116cc648bd1

View File

@@ -0,0 +1,35 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
namespace Ichni.Editor
{
/// <summary>
/// 参数文本 Drawer绑定字段并显示只读文本支持自动更新。
/// 创建 DynamicUIParameterText。
/// </summary>
public class ParameterTextDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("parameterText"), ctx.Parent);
var element = go.GetComponent<DynamicUIParameterText>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
if (ctx.AutoUpdate)
{
element.SetAutoUpdate(true);
}
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: f9545528a874aff49a39469a79e1860c

View File

@@ -0,0 +1,33 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理带 [InspectorSlider] 属性的 float/int 类型的 Drawer。
/// 创建 DynamicUISlider 并配置范围参数。
/// </summary>
public class SliderDrawer : IPropertyDrawer
{
public int DefaultSpan => 3;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("slider"), ctx.Parent);
var element = go.GetComponent<DynamicUISlider>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName,
ctx.SliderMin, ctx.SliderMax, ctx.SliderWholeNumbers);
DynamicUIElement.DisableNavigation(element.slider);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 8740b15baf2fd0147a93e04b4fd41051

View File

@@ -0,0 +1,35 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
namespace Ichni.Editor
{
/// <summary>
/// 处理 List&lt;string&gt; 选择的 Drawer。
/// 创建 DynamicUIStringListDropdown 并配置选项列表。
/// </summary>
public class StringListDropdownDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("stringListDropdown"), ctx.Parent);
var element = go.GetComponent<DynamicUIStringListDropdown>();
if (ctx.StringListOptions != null)
{
element.SetUpStringList(ctx.StringListOptions);
}
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: c9f1b1ee81941b94cbb465da262713bf

View File

@@ -0,0 +1,32 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理 bool 类型的 Drawer。
/// 创建 DynamicUIToggle。
/// </summary>
public class ToggleDrawer : IPropertyDrawer
{
public int DefaultSpan => 1;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("toggle"), ctx.Parent);
var element = go.GetComponent<DynamicUIToggle>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
DynamicUIElement.DisableNavigation(element.toggle);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 86988bf7af4e8864094e9fc687e93d29

View File

@@ -0,0 +1,38 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理 Vector2 类型的 Drawer。
/// 创建 DynamicUIVector2InputField。
/// </summary>
public class Vector2FieldDrawer : IPropertyDrawer
{
public int DefaultSpan => 2;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("vector2InputField"), ctx.Parent);
var element = go.GetComponent<DynamicUIVector2InputField>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
if (ctx.AutoUpdate)
{
element.SetAutoUpdate(true);
}
DynamicUIElement.DisableNavigation(element.inputFieldX, element.inputFieldY);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 77e741bd7c95a8d4690052986898525e

View File

@@ -0,0 +1,38 @@
using Ichni.RhythmGame;
using Lean.Pool;
using UnityEngine;
using UnityEngine.UI;
namespace Ichni.Editor
{
/// <summary>
/// 处理 Vector3 类型的 Drawer。
/// 创建 DynamicUIVector3InputField。
/// </summary>
public class Vector3FieldDrawer : IPropertyDrawer
{
public int DefaultSpan => 3;
public float DefaultHeight => LayoutPacker.DefaultRowHeight;
public DynamicUIElement Draw(DrawContext ctx)
{
var go = LeanPool.Spawn(ctx.Registry.GetPrefab("vector3InputField"), ctx.Parent);
var element = go.GetComponent<DynamicUIVector3InputField>();
element.Initialize(ctx.Target, ctx.Label, ctx.FieldName);
if (ctx.AutoUpdate)
{
element.SetAutoUpdate(true);
}
DynamicUIElement.DisableNavigation(element.inputFieldX, element.inputFieldY, element.inputFieldZ);
int span = ctx.OverrideSpan ?? DefaultSpan;
float height = ctx.OverrideHeight ?? DefaultHeight;
element.SetLayoutSize(span * LayoutPacker.TotalRowWidth / LayoutPacker.MaxSpanPerRow, height);
return element;
}
}
}

View File

@@ -0,0 +1,2 @@
fileFormatVersion: 2
guid: 09da90190e75fd14886f20c784b4bc6f