Files
XRLib/Assets/Scripts/UVC/UIToolkit/Property/Items/UTKIntPropertyItem.cs

102 lines
3.1 KiB
C#
Raw Normal View History

2026-01-08 20:15:57 +09:00
#nullable enable
2026-02-05 19:12:16 +09:00
using System;
2026-01-08 20:15:57 +09:00
2026-01-20 20:18:47 +09:00
namespace UVC.UIToolkit
2026-01-08 20:15:57 +09:00
{
/// <summary>
2026-02-04 20:31:52 +09:00
/// 정수 속성 데이터 클래스입니다.
/// UI는 UTKIntPropertyItemView에서 담당합니다.
2026-01-08 20:15:57 +09:00
/// </summary>
public class UTKIntPropertyItem : UTKPropertyItemBase<int>
{
#region Fields
private bool _useSlider;
2026-02-05 19:12:16 +09:00
private bool _useStepper;
private int _minValue = int.MinValue;
private int _maxValue = int.MaxValue;
2026-02-05 19:12:16 +09:00
private int _step = 1;
2026-01-08 20:15:57 +09:00
#endregion
#region Properties
2026-02-04 20:31:52 +09:00
/// <summary>속성 타입</summary>
2026-01-08 20:15:57 +09:00
public override UTKPropertyType PropertyType => UTKPropertyType.Int;
/// <summary>슬라이더 사용 여부</summary>
public bool UseSlider
{
get => _useSlider;
2026-02-05 19:12:16 +09:00
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);
2026-01-08 20:15:57 +09:00
}
/// <summary>최소값 (슬라이더 모드)</summary>
public int MinValue
{
get => _minValue;
2026-02-04 20:31:52 +09:00
set => _minValue = value;
2026-01-08 20:15:57 +09:00
}
/// <summary>최대값 (슬라이더 모드)</summary>
public int MaxValue
{
get => _maxValue;
2026-02-04 20:31:52 +09:00
set => _maxValue = value;
2026-01-08 20:15:57 +09:00
}
#endregion
#region Constructor
2026-02-04 20:31:52 +09:00
/// <summary>
/// 정수 속성을 생성합니다 (필드 모드).
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="initialValue">초기 값</param>
2026-01-08 20:15:57 +09:00
public UTKIntPropertyItem(string id, string name, int initialValue = 0)
: base(id, name, initialValue)
{
}
2026-02-04 20:31:52 +09:00
/// <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>
2026-02-10 20:48:49 +09:00
/// <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)
2026-01-08 20:15:57 +09:00
: base(id, name, initialValue)
{
_minValue = minValue;
_maxValue = maxValue;
_useSlider = useSlider;
2026-02-05 19:12:16 +09:00
_useStepper = useStepper;
2026-02-10 20:48:49 +09:00
_isReadOnly = isReadOnly;
_showLabel = showLabel;
2026-01-08 20:15:57 +09:00
}
#endregion
}
}