新Head
This commit is contained in:
37
Assets/Scripts/DynamicUI/Drawers/BaseColorPickerDrawer.cs
Normal file
37
Assets/Scripts/DynamicUI/Drawers/BaseColorPickerDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f148308680f4a4b47a9d1097376ca1aa
|
||||
40
Assets/Scripts/DynamicUI/Drawers/ButtonDrawer.cs
Normal file
40
Assets/Scripts/DynamicUI/Drawers/ButtonDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/DynamicUI/Drawers/ButtonDrawer.cs.meta
Normal file
2
Assets/Scripts/DynamicUI/Drawers/ButtonDrawer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23d17d2a4ce34f84a84f140f213d166c
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 444ef9b226757004f9290d1ea11d2c60
|
||||
49
Assets/Scripts/DynamicUI/Drawers/EnumDropdownDrawer.cs
Normal file
49
Assets/Scripts/DynamicUI/Drawers/EnumDropdownDrawer.cs
Normal 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 中的 EnumType,fallback 到反射
|
||||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 13456a684c2325341a1010f04d0dabb5
|
||||
38
Assets/Scripts/DynamicUI/Drawers/HintTextDrawer.cs
Normal file
38
Assets/Scripts/DynamicUI/Drawers/HintTextDrawer.cs
Normal file
@@ -0,0 +1,38 @@
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 提示文本 Drawer,支持静态文本和 Func<string> 动态文本。
|
||||
/// 创建 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/DynamicUI/Drawers/HintTextDrawer.cs.meta
Normal file
2
Assets/Scripts/DynamicUI/Drawers/HintTextDrawer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6437a7c7bdd1fe748b37bb0ebda0abd1
|
||||
42
Assets/Scripts/DynamicUI/Drawers/InputFieldDrawer.cs
Normal file
42
Assets/Scripts/DynamicUI/Drawers/InputFieldDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 00072d6a1502bc74d8b7d116cc648bd1
|
||||
35
Assets/Scripts/DynamicUI/Drawers/ParameterTextDrawer.cs
Normal file
35
Assets/Scripts/DynamicUI/Drawers/ParameterTextDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9545528a874aff49a39469a79e1860c
|
||||
33
Assets/Scripts/DynamicUI/Drawers/SliderDrawer.cs
Normal file
33
Assets/Scripts/DynamicUI/Drawers/SliderDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/DynamicUI/Drawers/SliderDrawer.cs.meta
Normal file
2
Assets/Scripts/DynamicUI/Drawers/SliderDrawer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 8740b15baf2fd0147a93e04b4fd41051
|
||||
35
Assets/Scripts/DynamicUI/Drawers/StringListDropdownDrawer.cs
Normal file
35
Assets/Scripts/DynamicUI/Drawers/StringListDropdownDrawer.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
using Ichni.RhythmGame;
|
||||
using Lean.Pool;
|
||||
using UnityEngine;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
/// <summary>
|
||||
/// 处理 List<string> 选择的 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: c9f1b1ee81941b94cbb465da262713bf
|
||||
32
Assets/Scripts/DynamicUI/Drawers/ToggleDrawer.cs
Normal file
32
Assets/Scripts/DynamicUI/Drawers/ToggleDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/DynamicUI/Drawers/ToggleDrawer.cs.meta
Normal file
2
Assets/Scripts/DynamicUI/Drawers/ToggleDrawer.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 86988bf7af4e8864094e9fc687e93d29
|
||||
38
Assets/Scripts/DynamicUI/Drawers/Vector2FieldDrawer.cs
Normal file
38
Assets/Scripts/DynamicUI/Drawers/Vector2FieldDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 77e741bd7c95a8d4690052986898525e
|
||||
38
Assets/Scripts/DynamicUI/Drawers/Vector3FieldDrawer.cs
Normal file
38
Assets/Scripts/DynamicUI/Drawers/Vector3FieldDrawer.cs
Normal 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 09da90190e75fd14886f20c784b4bc6f
|
||||
Reference in New Issue
Block a user