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,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;
}
}
}