Files
XRLib/Assets/Scripts/UVC/UIToolkit/Property/Items/UTKFloatRangePropertyItem.cs
2026-02-10 20:48:49 +09:00

119 lines
4.8 KiB
C#

#nullable enable
namespace UVC.UIToolkit
{
/// <summary>
/// 실수 범위 속성 데이터 클래스입니다.
/// UI는 UTKFloatRangePropertyItemView에서 담당합니다.
/// </summary>
public class UTKFloatRangePropertyItem : UTKPropertyItemBase<UTKFloatRange>
{
#region Fields
private bool _useStepper;
private float _stepperMinValue = float.MinValue;
private float _stepperMaxValue = float.MaxValue;
private float _stepperStep = 1.0f;
#endregion
#region Properties
/// <summary>속성 타입</summary>
public override UTKPropertyType PropertyType => UTKPropertyType.FloatRange;
/// <summary>스테퍼(증감 버튼) 사용 여부</summary>
public bool UseStepper
{
get => _useStepper;
set
{
_useStepper = value;
}
}
/// <summary>스테퍼 증감 단위 (기본값: 1.0)</summary>
public float StepperStep
{
get => _stepperStep;
set => _stepperStep = value > 0 ? value : 1.0f;
}
/// <summary>스테퍼 최소값</summary>
public float StepperMinValue
{
get => _stepperMinValue;
set => _stepperMinValue = value;
}
/// <summary>스테퍼 최대값</summary>
public float StepperMaxValue
{
get => _stepperMaxValue;
set => _stepperMaxValue = value;
}
#endregion
#region Constructor
/// <summary>
/// 실수 범위 속성을 생성합니다 (필드 모드).
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="initialValue">초기 범위 값</param>
/// <param name="isReadOnly">읽기 전용 여부</param>
/// <param name="showLabel">레이블 표시 여부</param>
public UTKFloatRangePropertyItem(string id, string name, UTKFloatRange initialValue = default, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue)
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
/// <summary>
/// 실수 범위 속성을 생성합니다.
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="min">최소값</param>
/// <param name="max">최대값</param>
/// <param name="stepperStep">스테퍼 증감 단위</param>
/// <param name="stepperMinValue">스테퍼 최소값</param>
/// <param name="stepperMaxValue">스테퍼 최대값</param>
/// <param name="useStepper">스테퍼 사용 여부</param>
/// <param name="isReadOnly">읽기 전용 여부</param>
/// <param name="showLabel">레이블 표시 여부</param>
public UTKFloatRangePropertyItem(string id, string name, float min, float max, float stepperStep = 1.0f, float stepperMinValue = float.MinValue, float stepperMaxValue = float.MaxValue, bool useStepper = false, bool isReadOnly = false, bool showLabel = true)
: base(id, name, new UTKFloatRange(min, max))
{
_stepperMinValue = stepperMinValue;
_stepperMaxValue = stepperMaxValue;
_useStepper = useStepper;
_stepperStep = stepperStep;
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
/// <summary>
/// 실수 범위 속성을 생성합니다 (스테퍼 모드).
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="initialValue">초기 범위 값</param>
/// <param name="stepperStep">스테퍼 증감 단위</param>
/// <param name="stepperMinValue">스테퍼 최소값</param>
/// <param name="stepperMaxValue">스테퍼 최대값</param>
/// <param name="useStepper">스테퍼 사용 여부</param>
/// <param name="isReadOnly">읽기 전용 여부</param>
/// <param name="showLabel">레이블 표시 여부</param>
public UTKFloatRangePropertyItem(string id, string name, UTKFloatRange initialValue, float stepperStep = 1.0f, float stepperMinValue = float.MinValue, float stepperMaxValue = float.MaxValue, bool useStepper = false, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue)
{
_stepperMinValue = stepperMinValue;
_stepperMaxValue = stepperMaxValue;
_useStepper = useStepper;
_stepperStep = stepperStep;
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
#endregion
}
}