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

61 lines
2.3 KiB
C#

#nullable enable
using System;
namespace UVC.UIToolkit
{
/// <summary>
/// 날짜시간 범위 속성 데이터 클래스입니다.
/// UI는 UTKDateTimeRangePropertyItemView에서 담당합니다.
/// </summary>
public class UTKDateTimeRangePropertyItem : UTKPropertyItemBase<UTKDateTimeRange>
{
#region Fields
private string _dateTimeFormat = "yyyy-MM-dd HH:mm";
#endregion
#region Properties
/// <summary>속성 타입</summary>
public override UTKPropertyType PropertyType => UTKPropertyType.DateTimeRange;
/// <summary>날짜시간 표시 형식</summary>
public string DateTimeFormat
{
get => _dateTimeFormat;
set => _dateTimeFormat = value ?? "yyyy-MM-dd HH:mm";
}
#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 UTKDateTimeRangePropertyItem(string id, string name, UTKDateTimeRange initialValue = default, bool isReadOnly = false, bool showLabel = true)
: base(id, name, initialValue.Start == default ? new UTKDateTimeRange(DateTime.Now, DateTime.Now) : initialValue)
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
/// <summary>
/// 날짜시간 범위 속성을 생성합니다.
/// </summary>
/// <param name="id">고유 ID</param>
/// <param name="name">표시 이름</param>
/// <param name="start">시작 날짜시간</param>
/// <param name="end">종료 날짜시간</param>
/// <param name="isReadOnly">읽기 전용 여부</param>
public UTKDateTimeRangePropertyItem(string id, string name, DateTime start, DateTime end, bool isReadOnly = false, bool showLabel = true)
: base(id, name, new UTKDateTimeRange(start, end))
{
_isReadOnly = isReadOnly;
_showLabel = showLabel;
}
#endregion
}
}