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

102 lines
3.1 KiB
C#

#nullable enable
using System;
namespace UVC.UIToolkit
{
/// <summary>
/// 정수 속성 데이터 클래스입니다.
/// UI는 UTKIntPropertyItemView에서 담당합니다.
/// </summary>
public class UTKIntPropertyItem : UTKPropertyItemBase<int>
{
#region Fields
private bool _useSlider;
private bool _useStepper;
private int _minValue = int.MinValue;
private int _maxValue = int.MaxValue;
private int _step = 1;
#endregion
#region Properties
/// <summary>속성 타입</summary>
public override UTKPropertyType PropertyType => UTKPropertyType.Int;
/// <summary>슬라이더 사용 여부</summary>
public bool UseSlider
{
get => _useSlider;
set
{
_useSlider = value;
}
}
/// <summary>스테퍼(증감 버튼) 사용 여부</summary>
public bool UseStepper
{
get => _useStepper;
set
{
_useStepper = value;
}
}
/// <summary>스테퍼 증감 단위 (기본값: 1)</summary>
public int Step
{
get => _step;
set => _step = Math.Max(1, value);
}
/// <summary>최소값 (슬라이더 모드)</summary>
public int MinValue
{
get => _minValue;
set => _minValue = value;
}
/// <summary>최대값 (슬라이더 모드)</summary>
public int MaxValue
{
get => _maxValue;
set => _maxValue = value;
}
#endregion
#region Constructor
/// <summary>
/// 정수 속성을 생성합니다 (필드 모드).
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="initialValue">초기 값</param>
public UTKIntPropertyItem(string id, string name, int initialValue = 0)
: base(id, name, initialValue)
{
}
/// <summary>
/// 정수 속성을 생성합니다 (슬라이더 모드).
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="initialValue">초기 값</param>
/// <param name="minValue">최소값</param>
/// <param name="maxValue">최대값</param>
/// <param name="useSlider">슬라이더 사용 여부</param>
/// <param name="isReadOnly">읽기 전용 여부</param>
/// <param name="showLabel">라벨 표시 여부</param>
public UTKIntPropertyItem(string id, string name, int initialValue, int minValue, int maxValue, bool useSlider = false, bool useStepper = false, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue)
{
_minValue = minValue;
_maxValue = maxValue;
_useSlider = useSlider;
_useStepper = useStepper;
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
#endregion
}
}