PropertyWindow 기능 추가

This commit is contained in:
logonkhi
2025-09-25 16:31:52 +09:00
parent 4c87f14f14
commit 4dc92b31e9
109 changed files with 41726 additions and 3169 deletions

View File

@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.InputSystem;
namespace UVC.UI.Window.PropertyWindow
{
@@ -249,44 +250,28 @@ namespace UVC.UI.Window.PropertyWindow
}
// --- 범위 타입 속성 ---
public class IntRangeProperty : PropertyItem<int>
public class IntRangeProperty : PropertyItem<Tuple<int, int>>
{
public override PropertyType PropertyType => PropertyType.IntRange;
public int Value2 { get; set; }
public IntRangeProperty(string id, string name, int startValue, int endValue) : base(id, name, startValue)
{
Value2 = endValue;
}
public IntRangeProperty(string id, string name, Tuple<int, int> initialValue) : base(id, name, initialValue) { }
}
public class FloatRangeProperty : PropertyItem<float>
public class FloatRangeProperty : PropertyItem<Tuple<float, float>>
{
public override PropertyType PropertyType => PropertyType.FloatRange;
public float Value2 { get; set; }
public FloatRangeProperty(string id, string name, float startValue, float endValue) : base(id, name, startValue)
{
Value2 = endValue;
}
public FloatRangeProperty(string id, string name, Tuple<float, float> initialValue) : base(id, name, initialValue) { }
}
public class DateRangeProperty : PropertyItem<DateTime>
public class DateRangeProperty : PropertyItem<Tuple<DateTime, DateTime>>
{
public override PropertyType PropertyType => PropertyType.DateRange;
public DateTime Value2 { get; set; }
public DateRangeProperty(string id, string name, DateTime startValue, DateTime endValue) : base(id, name, startValue)
{
Value2 = endValue;
}
public DateRangeProperty(string id, string name, Tuple<DateTime, DateTime> initialValue) : base(id, name, initialValue) { }
}
public class DateTimeRangeProperty : PropertyItem<DateTime>
public class DateTimeRangeProperty : PropertyItem<Tuple<DateTime, DateTime>>
{
public override PropertyType PropertyType => PropertyType.DateRange;
public DateTime Value2 { get; set; }
public DateTimeRangeProperty(string id, string name, DateTime startValue, DateTime endValue) : base(id, name, startValue)
{
Value2 = endValue;
}
public override PropertyType PropertyType => PropertyType.DateTimeRange;
public DateTimeRangeProperty(string id, string name, Tuple<DateTime, DateTime> initialValue) : base(id, name, initialValue) { }
}
// --- 열거형 및 목록 타입 속성 ---

View File

@@ -147,7 +147,7 @@ namespace UVC.UI.Window.PropertyWindow
/// </summary>
private void OnPropertyValueChanged(object sender, PropertyValueChangedEventArgs e)
{
Debug.Log($"[PropertyView] 속성 변경 감지: ID='{e.PropertyId}', 이전 값='{e.OldValue}', 새 값='{e.NewValue}'");
//Debug.Log($"[PropertyView] 속성 변경 감지: ID='{e.PropertyId}', 이전 값='{e.OldValue}', 새 값='{e.NewValue}'");
// 여기서 특정 속성 값의 변경에 따라 다른 UI를 업데이트하는 로직을 추가할 수 있습니다.
// 예: 특정 bool 속성이 false가 되면 다른 속성 UI를 비활성화 처리

View File

@@ -4,7 +4,9 @@ using System;
using System.Collections.Generic;
using System.Linq;
using UnityEngine;
using UnityEngine.EventSystems;
using UVC.Core;
using UVC.Factory;
namespace UVC.UI.Window.PropertyWindow
{
@@ -12,7 +14,7 @@ namespace UVC.UI.Window.PropertyWindow
/// 속성 데이터를 관리하고, 데이터 변경 시 이벤트를 발생시키는 컨트롤러 클래스입니다.
/// Model과 View 사이의 중재자 역할을 합니다.
/// </summary>
public class PropertyWindow: SingletonScene<PropertyWindow>
public class PropertyWindow: SingletonScene<PropertyWindow>, IPointerEnterHandler, IPointerExitHandler
{
[SerializeField]
@@ -62,8 +64,8 @@ namespace UVC.UI.Window.PropertyWindow
// 이전 값을 저장합니다.
object oldValue = propertyItem.GetValue();
// 새 값과 이전 값이 같은지 확인합니다. (불필요한 이벤트 발생 방지)
if (Equals(oldValue, newValue))
// 값 타입일 때 새 값과 이전 값이 같은지 확인합니다. 참조 타입은 PropertyUI에서 필터링 (불필요한 이벤트 발생 방지)
if (oldValue.GetType().IsValueType && Equals(oldValue, newValue))
{
return;
}
@@ -104,5 +106,23 @@ namespace UVC.UI.Window.PropertyWindow
gameObject.SetActive(false);
}
/// <summary>
/// 마우스 포인터가 이 UI 요소의 영역 안으로 들어왔을 때 호출됩니다.
/// UI와 상호작용하는 동안 3D 뷰의 카메라가 움직이지 않도록 컨트롤러를 비활성화합니다.
/// </summary>
public virtual void OnPointerEnter(PointerEventData eventData)
{
FactoryCameraController.Instance.Enable = false; // 카메라 컨트롤러 비활성화
}
/// <summary>
/// 마우스 포인터가 이 UI 요소의 영역 밖으로 나갔을 때 호출됩니다.
/// 카메라 컨트롤을 다시 활성화하여 3D 뷰를 조작할 수 있도록 합니다.
/// </summary>
public virtual void OnPointerExit(PointerEventData eventData)
{
FactoryCameraController.Instance.Enable = true; // 카메라 컨트롤러 활성화
}
}
}

View File

@@ -23,7 +23,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
[SerializeField]
private Toggle _valueToggle; // boolean 값을 표시하고 수정할 Toggle 컴포넌트
private IPropertyItem _propertyItem;
private BoolProperty _propertyItem;
private PropertyWindow _controller;
/// <summary>
@@ -33,7 +33,14 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="controller">상호작용할 PropertyWindow</param>
public void Setup(IPropertyItem item, PropertyWindow controller)
{
_propertyItem = item;
if (!(item is BoolProperty typedItem))
{
Debug.LogError($"BoolPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
_propertyItem = typedItem;
_controller = controller;
// --- 데이터 바인딩 ---
@@ -58,10 +65,9 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 2. Toggle의 현재 값 설정 (object를 bool로 캐스팅)
if (_propertyItem.GetValue() is bool value)
{
_valueToggle.isOn = value;
}
_valueToggle.isOn = _propertyItem.Value;
// 3. 읽기 전용 상태에 따라 Toggle의 상호작용 여부 결정
_valueToggle.interactable = !_propertyItem.IsReadOnly;
@@ -78,6 +84,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="newValue">Toggle의 새로운 상태 (true/false)</param>
private void OnValueChanged(bool newValue)
{
if(newValue == _propertyItem.Value)
{
// 값이 실제로 변경되지 않은 경우, 불필요한 업데이트를 방지합니다.
return;
}
// PropertyController를 통해 모델의 값을 업데이트합니다.
// 이 호출은 PropertyValueChanged 이벤트를 발생시킵니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);

View File

@@ -31,7 +31,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
[SerializeField]
private Button _colorPickerButton; // 색상 선택기를 열기 위한 Button
private IPropertyItem _propertyItem;
private ColorProperty _propertyItem;
private PropertyWindow _controller;
private bool openningColorPickered = false;
@@ -43,7 +43,14 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="controller">상호작용할 PropertyWindow</param>
public void Setup(IPropertyItem item, PropertyWindow controller)
{
_propertyItem = item;
if (!(item is ColorProperty typedItem))
{
Debug.LogError($"ColorPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
_propertyItem = typedItem;
_controller = controller;
// --- 데이터 바인딩 ---
@@ -68,10 +75,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 2. 색상 미리보기 Image의 색상 설정
if (_propertyItem.GetValue() is Color color)
{
_colorPreviewImage.color = color;
}
_colorPreviewImage.color = _propertyItem.Value;
_colorLabel.text = ColorUtil.ToHex(_colorPreviewImage.color, true, false);
_colorLabel.interactable = !_propertyItem.IsReadOnly;
@@ -89,16 +93,13 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <summary>
/// 색상 선택기 버튼을 클릭했을 때 호출됩니다.
/// </summary>
private void OpenColorPicker()
private async void OpenColorPicker()
{
if(openningColorPickered == true) return;
openningColorPickered = true;
// TODO: 여기에 프로젝트에 맞는 실제 색상 선택기(Color Picker)를 여는 코드를 구현해야 합니다.
// 색상 선택기는 보통 패널 형태로 구현되며, 선택 완료 시 콜백으로 새로운 색상 값을 반환합니다.
//
// 예시:
_ = ColorPicker.Create(_colorPreviewImage.color, "Color Picker", null, OnColorSelected, OnCloseColorPicker, true);
CursorManager.Instance.SetCursor(CursorType.Wait);
await ColorPicker.Create(_colorPreviewImage.color, "Color Picker", null, OnColorSelected, OnCloseColorPicker, true);
CursorManager.Instance.SetDefaultCursor();
Debug.LogWarning($"'{_propertyItem.Name}'의 색상 선택기 로직이 구현되지 않았습니다. 클릭 이벤트만 발생합니다.");
}
@@ -108,6 +109,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="newColor">선택된 새로운 색상</param>
public void OnColorSelected(Color newColor)
{
if (newColor == _propertyItem.Value)
{
return; // 변경 사항이 없으므로 아무 작업도 하지 않음
}
// 1. UI의 색상 미리보기를 업데이트합니다.
_colorPreviewImage.color = newColor;

View File

@@ -5,7 +5,8 @@ using UnityEngine.UI;
using UVC.Extention;
using UVC.UI.Modal;
using UVC.UI.Modal.DatePicker;
using UVC.UI.Tooltip; // DatePickerManager가 위치할 네임스페이스
using UVC.UI.Tooltip;
using UVC.Util; // DatePickerManager가 위치할 네임스페이스
namespace UVC.UI.Window.PropertyWindow.UI
{
@@ -24,12 +25,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
private TextMeshProUGUI _descriptionLabel;
[SerializeField]
private TextMeshProUGUI _dateText; // 선택된 날짜를 표시할 Text
private TMP_InputField _dateText; // 선택된 날짜를 표시할 Text
[SerializeField]
private Button _datePickerButton; // Date Picker를 열기 위한 Button
private IPropertyItem _propertyItem;
private DateProperty _propertyItem;
private PropertyWindow _controller;
private const string DateFormat = "yyyy-MM-dd"; // 날짜 표시 형식
@@ -40,7 +41,13 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="controller">상호작용할 PropertyWindow</param>
public void Setup(IPropertyItem item, PropertyWindow controller)
{
_propertyItem = item;
if (!(item is DateProperty typedItem))
{
Debug.LogError($"DatePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
_propertyItem = typedItem;
_controller = controller;
// --- 데이터 바인딩 ---
@@ -63,12 +70,11 @@ namespace UVC.UI.Window.PropertyWindow.UI
_descriptionLabel.text = _propertyItem.Description;
}
if (_propertyItem.GetValue() is DateTime dateTime)
{
_dateText.text = dateTime.ToString(DateFormat);
}
_dateText.text = _propertyItem.Value.ToString(DateFormat);
_dateText.interactable = !_propertyItem.IsReadOnly;
_datePickerButton.interactable = !_propertyItem.IsReadOnly;
_datePickerButton.gameObject.SetActive(!_propertyItem.IsReadOnly);
// --- 이벤트 리스너 등록 ---
_datePickerButton.onClick.RemoveAllListeners();
@@ -78,15 +84,11 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <summary>
/// 날짜 선택기 버튼을 클릭했을 때 호출됩니다.
/// </summary>
private void OpenDatePicker()
private async void OpenDatePicker()
{
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DatePicker.Show(currentDateTime, (newDate) =>
{
OnDateSelected(newDate);
});
}
CursorManager.Instance.SetCursor(CursorType.Wait);
await DatePicker.Show(_propertyItem.Value, OnDateSelected);
CursorManager.Instance.SetDefaultCursor();
}
/// <summary>
@@ -95,6 +97,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="newDate">선택된 새로운 날짜</param>
public void OnDateSelected(DateTime newDate)
{
// 선택된 날짜가 현재 값과 다를 때만 업데이트
if (_propertyItem.Value.ToString(DateFormat) == newDate.ToString(DateFormat))
{
return; // 변경 사항이 없으므로 아무 작업도 하지 않음
}
// 1. UI의 날짜 텍스트를 업데이트합니다.
_dateText.text = newDate.ToString(DateFormat);

View File

@@ -6,6 +6,7 @@ using UVC.Extention;
using UVC.UI.Modal;
using UVC.UI.Modal.DatePicker;
using UVC.UI.Tooltip;
using UVC.Util;
namespace UVC.UI.Window.PropertyWindow.UI
{
@@ -24,12 +25,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
private TextMeshProUGUI _descriptionLabel;
[SerializeField]
private TextMeshProUGUI _startDateText; // 시작 날짜 표시
private TMP_InputField _startDateText; // 시작 날짜 표시
[SerializeField]
private Button _startDatePickerButton; // 시작 날짜 선택 버튼
[SerializeField]
private TextMeshProUGUI _endDateText; // 끝 날짜 표시
private TMP_InputField _endDateText; // 끝 날짜 표시
[SerializeField]
private Button _endDatePickerButton; // 끝 날짜 선택 버튼
@@ -44,7 +45,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is DateRangeProperty dateRangeItem))
{
Debug.LogError("DateRangePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"DateRangePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -72,13 +73,17 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 초기 값 설정
_startDateText.text = _propertyItem.Value.ToString(DateFormat);
_endDateText.text = _propertyItem.Value2.ToString(DateFormat);
_startDateText.text = _propertyItem.Value.Item1.ToString(DateFormat);
_endDateText.text = _propertyItem.Value.Item2.ToString(DateFormat);
// 읽기 전용 상태 설정
bool isReadOnly = _propertyItem.IsReadOnly;
_startDateText.interactable = !isReadOnly;
_endDateText.interactable = !isReadOnly;
_startDatePickerButton.interactable = !isReadOnly;
_endDatePickerButton.interactable = !isReadOnly;
_startDatePickerButton.gameObject.SetActive(!isReadOnly);
_endDatePickerButton.gameObject.SetActive(!isReadOnly);
// --- 이벤트 리스너 등록 ---
_startDatePickerButton.onClick.RemoveAllListeners();
@@ -87,32 +92,36 @@ namespace UVC.UI.Window.PropertyWindow.UI
_endDatePickerButton.onClick.AddListener(OpenEndDatePicker);
}
private void OpenStartDatePicker()
private async void OpenStartDatePicker()
{
DatePicker.Show(_propertyItem.Value, OnStartDateSelected);
CursorManager.Instance.SetCursor(CursorType.Wait);
await DatePicker.Show(_propertyItem.Value.Item1, OnStartDateSelected);
CursorManager.Instance.SetDefaultCursor();
}
private void OpenEndDatePicker()
private async void OpenEndDatePicker()
{
DatePicker.Show(_propertyItem.Value2, OnEndDateSelected);
CursorManager.Instance.SetCursor(CursorType.Wait);
await DatePicker.Show(_propertyItem.Value.Item2, OnEndDateSelected);
CursorManager.Instance.SetDefaultCursor();
}
private void OnStartDateSelected(DateTime newStartDate)
{
var oldValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
//이전 값이랑 같으면 리턴
if (_propertyItem.Value.Item1.ToString(DateFormat) == newStartDate.ToString(DateFormat)) return;
DateTime Item1 = newStartDate;
DateTime Item2 = _propertyItem.Value.Item2;
// 시작 날짜가 끝 날짜보다 늦어지지 않도록 보정
if (newStartDate > _propertyItem.Value2)
{
_propertyItem.Value2 = newStartDate;
}
_propertyItem.Value = newStartDate;
if (newStartDate > _propertyItem.Value.Item2) Item2 = newStartDate;
var newValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
var newValue = new Tuple<DateTime, DateTime>(Item1, Item2);
// UI 업데이트
_startDateText.text = _propertyItem.Value.ToString(DateFormat);
_endDateText.text = _propertyItem.Value2.ToString(DateFormat);
_startDateText.text = Item1.ToString(DateFormat);
_endDateText.text = Item2.ToString(DateFormat);
// 변경 이벤트 알림
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
@@ -120,20 +129,19 @@ namespace UVC.UI.Window.PropertyWindow.UI
private void OnEndDateSelected(DateTime newEndDate)
{
var oldValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
//이전 값이랑 같으면 리턴
if (_propertyItem.Value.Item2.ToString(DateFormat) == newEndDate.ToString(DateFormat)) return;
DateTime Item1 = _propertyItem.Value.Item1;
DateTime Item2 = newEndDate;
// 끝 날짜가 시작 날짜보다 빨라지지 않도록 보정
if (newEndDate < _propertyItem.Value)
{
_propertyItem.Value = newEndDate;
}
_propertyItem.Value2 = newEndDate;
if (newEndDate < Item1) Item1 = newEndDate;
var newValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
var newValue = new Tuple<DateTime, DateTime>(Item1, Item2);
// UI 업데이트
_startDateText.text = _propertyItem.Value.ToString(DateFormat);
_endDateText.text = _propertyItem.Value2.ToString(DateFormat);
_startDateText.text = Item1.ToString(DateFormat);
_endDateText.text = Item2.ToString(DateFormat);
// 변경 이벤트 알림
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);

View File

@@ -4,9 +4,9 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UVC.Extention;
using UVC.UI.Modal;
using UVC.UI.Modal.DatePicker;
using UVC.UI.Tooltip; // DateTimePickerManager가 위치할 네임스페이스
using UVC.UI.Tooltip;
using UVC.Util; // DateTimePickerManager가 위치할 네임스페이스
namespace UVC.UI.Window.PropertyWindow.UI
{
@@ -25,7 +25,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
private TextMeshProUGUI _descriptionLabel;
[SerializeField]
private TextMeshProUGUI _dateText; // 선택된 날짜를 표시할 Text
private TMP_InputField _dateText; // 선택된 날짜를 표시할 Text
[SerializeField]
private TMP_Dropdown _hourDropDown; // 선택된 시간을 표시
@@ -36,9 +36,10 @@ namespace UVC.UI.Window.PropertyWindow.UI
[SerializeField]
private Button _dateTimePickerButton; // DateTime Picker를 열기 위한 Button
private IPropertyItem _propertyItem;
private DateTimeProperty _propertyItem;
private PropertyWindow _controller;
private const string DateFormat = "yyyy-MM-ddmm"; // 날짜 표시 형식
private const string DateFormat = "yyyy-MM-dd"; // 날짜 표시 형식
private const string FullDateFormat = "yyyy-MM-dd HH:mm:ss"; // 날짜 표시 형식
/// <summary>
/// PropertyView에 의해 호출되어 UI를 초기화하고 데이터를 설정합니다.
@@ -47,12 +48,18 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="controller">상호작용할 PropertyWindow</param>
public void Setup(IPropertyItem item, PropertyWindow controller)
{
_propertyItem = item;
if (!(item is DateTimeProperty typedItem))
{
Debug.LogError($"DateTimePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
_propertyItem = typedItem;
_controller = controller;
List<string> hourOptions = new List<string>();
List<string> minuteOptions = new List<string>();
for (int i = 0; i < 60; i ++)
for (int i = 0; i < 60; i++)
{
if (i < 24) hourOptions.Add(i.ToString("D2"));
minuteOptions.Add(i.ToString("D2"));
@@ -80,63 +87,70 @@ namespace UVC.UI.Window.PropertyWindow.UI
_descriptionLabel.text = _propertyItem.Description;
}
if (_propertyItem.GetValue() is DateTime dateTime)
{
_dateText.text = dateTime.ToString(DateFormat);
_hourDropDown.value = dateTime.Hour;
_miniteDropDown.value = dateTime.Minute;
}
_dateText.text = _propertyItem.Value.ToString(DateFormat);
_hourDropDown.SetValueWithoutNotify(_propertyItem.Value.Hour);
_miniteDropDown.SetValueWithoutNotify(_propertyItem.Value.Minute);
_dateText.interactable = !_propertyItem.IsReadOnly;
_dateTimePickerButton.interactable = !_propertyItem.IsReadOnly;
_dateTimePickerButton.gameObject.SetActive(!_propertyItem.IsReadOnly);
// --- 이벤트 리스너 등록 ---
_dateTimePickerButton.onClick.RemoveAllListeners();
_dateTimePickerButton.onClick.AddListener(OpenDateTimePicker);
_hourDropDown.interactable = !_propertyItem.IsReadOnly;
_hourDropDown.onValueChanged.RemoveAllListeners();
_hourDropDown.onValueChanged.AddListener((int hour) => {
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DateTime newDateTime = new DateTime(
currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
hour,
currentDateTime.Minute,
currentDateTime.Second
);
OnDateTimeSelected(newDateTime);
}
_hourDropDown.onValueChanged.AddListener((int hour) =>
{
DateTime newDateTime = new DateTime(
_propertyItem.Value.Year,
_propertyItem.Value.Month,
_propertyItem.Value.Day,
hour,
_propertyItem.Value.Minute,
0
);
OnDateTimeSelected(newDateTime);
});
_miniteDropDown.interactable = !_propertyItem.IsReadOnly;
_miniteDropDown.onValueChanged.RemoveAllListeners();
_miniteDropDown.onValueChanged.AddListener((int minute) => {
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DateTime newDateTime = new DateTime(
currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
currentDateTime.Hour,
minute,
currentDateTime.Second
);
OnDateTimeSelected(newDateTime);
}
_miniteDropDown.onValueChanged.AddListener((int minute) =>
{
DateTime newDateTime = new DateTime(
_propertyItem.Value.Year,
_propertyItem.Value.Month,
_propertyItem.Value.Day,
_propertyItem.Value.Hour,
minute,
0
);
OnDateTimeSelected(newDateTime);
});
}
/// <summary>
/// 날짜 및 시간 선택기 버튼을 클릭했을 때 호출됩니다.
/// </summary>
private void OpenDateTimePicker()
private async void OpenDateTimePicker()
{
if (_propertyItem.GetValue() is DateTime currentDateTime)
CursorManager.Instance.SetCursor(CursorType.Wait);
await DatePicker.Show(_propertyItem.Value, newDate =>
{
DatePicker.Show(currentDateTime, (newDateTime) =>
{
OnDateTimeSelected(newDateTime);
});
}
DateTime newDateTime = new DateTime(
newDate.Year,
newDate.Month,
newDate.Day,
_propertyItem.Value.Hour,
_propertyItem.Value.Minute,
0
);
OnDateTimeSelected(newDateTime);
});
CursorManager.Instance.SetDefaultCursor();
}
/// <summary>
@@ -145,6 +159,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="newDateTime">선택된 새로운 날짜와 시간</param>
public void OnDateTimeSelected(DateTime newDateTime)
{
// 선택된 날짜가 현재 값과 다를 때만 업데이트
if (_propertyItem.Value.ToString(FullDateFormat) == newDateTime.ToString(FullDateFormat))
{
return; // 변경 사항이 없으므로 아무 작업도 하지 않음
}
// 1. UI의 텍스트를 업데이트합니다.
_dateText.text = newDateTime.ToString(DateFormat);

View File

@@ -4,9 +4,9 @@ using TMPro;
using UnityEngine;
using UnityEngine.UI;
using UVC.Extention;
using UVC.UI.Modal;
using UVC.UI.Modal.DatePicker;
using UVC.UI.Tooltip;
using UVC.Util;
namespace UVC.UI.Window.PropertyWindow.UI
{
@@ -25,7 +25,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
private TextMeshProUGUI _descriptionLabel;
[SerializeField]
private TextMeshProUGUI _startDateText; // 시작 날짜 표시
private TMP_InputField _startDateText; // 시작 날짜 표시
[SerializeField]
private Button _startDatePickerButton; // 시작 날짜/시간 선택 버튼
@@ -36,7 +36,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
private TMP_Dropdown _startMiniteDropDown; // 선택된 분을 표시
[SerializeField]
private TextMeshProUGUI _endDateText; // 끝 날짜/시간 표시
private TMP_InputField _endDateText; // 끝 날짜/시간 표시
[SerializeField]
private Button _endDatePickerButton; // 끝 날짜/시간 선택 버튼
@@ -49,6 +49,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
private DateTimeRangeProperty _propertyItem;
private PropertyWindow _controller;
private const string DateFormat = "yyyy-MM-dd"; // 날짜 표시 형식
private const string FullDateFormat = "yyyy-MM-dd HH:mm:ss"; // 날짜 표시 형식
/// <summary>
/// PropertyView에 의해 호출되어 UI를 초기화하고 데이터를 설정합니다.
@@ -57,7 +58,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is DateTimeRangeProperty dateTimeRangeItem))
{
Debug.LogError("DateTimeRangePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"DateTimeRangePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -76,6 +77,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
_endHourDropDown.AddOptions(hourOptions);
_endMiniteDropDown.AddOptions(minuteOptions);
_startHourDropDown.SetValueWithoutNotify(_propertyItem.Value.Item1.Hour);
_startMiniteDropDown.SetValueWithoutNotify(_propertyItem.Value.Item1.Minute);
_endHourDropDown.SetValueWithoutNotify(_propertyItem.Value.Item2.Hour);
_endMiniteDropDown.SetValueWithoutNotify(_propertyItem.Value.Item2.Minute);
// --- 데이터 바인딩 ---
_nameLabel.text = _propertyItem.Name;
@@ -97,111 +104,145 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 초기 값 설정
_startDateText.text = _propertyItem.Value.ToString(DateFormat);
_endDateText.text = _propertyItem.Value2.ToString(DateFormat);
_startDateText.text = _propertyItem.Value.Item1.ToString(DateFormat);
_endDateText.text = _propertyItem.Value.Item2.ToString(DateFormat);
// 읽기 전용 상태 설정
bool isReadOnly = _propertyItem.IsReadOnly;
_startDateText.interactable = !isReadOnly;
_endDateText.interactable = !isReadOnly;
_startDatePickerButton.interactable = !isReadOnly;
_endDatePickerButton.interactable = !isReadOnly;
_startDatePickerButton.gameObject.SetActive(!isReadOnly);
_endDatePickerButton.gameObject.SetActive(!isReadOnly);
// --- 이벤트 리스너 등록 ---
_startDatePickerButton.onClick.RemoveAllListeners();
_endDatePickerButton.onClick.RemoveAllListeners();
_startDatePickerButton.onClick.AddListener(OpenStartDateTimePicker);
_endDatePickerButton.onClick.AddListener(OpenEndDateTimePicker);
_startHourDropDown.interactable = !isReadOnly;
_startHourDropDown.onValueChanged.RemoveAllListeners();
_startHourDropDown.onValueChanged.AddListener((int hour) => {
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DateTime newDateTime = new DateTime(
currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
hour,
currentDateTime.Minute,
currentDateTime.Second
);
OnStartDateTimeSelected(newDateTime);
}
_startHourDropDown.onValueChanged.AddListener((int hour) =>
{
DateTime newDateTime = new DateTime(
_propertyItem.Value.Item1.Year,
_propertyItem.Value.Item1.Month,
_propertyItem.Value.Item1.Day,
hour,
_propertyItem.Value.Item1.Minute,
0
);
OnStartDateTimeSelected(newDateTime);
});
_startMiniteDropDown.interactable = !isReadOnly;
_startMiniteDropDown.onValueChanged.RemoveAllListeners();
_startMiniteDropDown.onValueChanged.AddListener((int minute) => {
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DateTime newDateTime = new DateTime(
currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
currentDateTime.Hour,
minute,
currentDateTime.Second
);
OnStartDateTimeSelected(newDateTime);
}
_startMiniteDropDown.onValueChanged.AddListener((int minute) =>
{
DateTime newDateTime = new DateTime(
_propertyItem.Value.Item1.Year,
_propertyItem.Value.Item1.Month,
_propertyItem.Value.Item1.Day,
_propertyItem.Value.Item1.Hour,
minute,
0
);
OnStartDateTimeSelected(newDateTime);
});
_endHourDropDown.interactable = !isReadOnly;
_endHourDropDown.onValueChanged.RemoveAllListeners();
_endHourDropDown.onValueChanged.AddListener((int hour) => {
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DateTime newDateTime = new DateTime(
currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
hour,
currentDateTime.Minute,
currentDateTime.Second
);
OnEndDateTimeSelected(newDateTime);
}
_endHourDropDown.onValueChanged.AddListener((int hour) =>
{
DateTime newDateTime = new DateTime(
_propertyItem.Value.Item2.Year,
_propertyItem.Value.Item2.Month,
_propertyItem.Value.Item2.Day,
hour,
_propertyItem.Value.Item2.Minute,
0
);
OnEndDateTimeSelected(newDateTime);
});
_endMiniteDropDown.interactable = !isReadOnly;
_endMiniteDropDown.onValueChanged.RemoveAllListeners();
_endMiniteDropDown.onValueChanged.AddListener((int minute) => {
if (_propertyItem.GetValue() is DateTime currentDateTime)
{
DateTime newDateTime = new DateTime(
currentDateTime.Year,
currentDateTime.Month,
currentDateTime.Day,
currentDateTime.Hour,
minute,
currentDateTime.Second
);
OnEndDateTimeSelected(newDateTime);
}
_endMiniteDropDown.onValueChanged.AddListener((int minute) =>
{
DateTime newDateTime = new DateTime(
_propertyItem.Value.Item2.Year,
_propertyItem.Value.Item2.Month,
_propertyItem.Value.Item2.Day,
_propertyItem.Value.Item2.Hour,
minute,
0
);
OnEndDateTimeSelected(newDateTime);
});
}
private void OpenStartDateTimePicker()
private async void OpenStartDateTimePicker()
{
DatePicker.Show(_propertyItem.Value, OnStartDateTimeSelected);
CursorManager.Instance.SetDefaultCursor();
await DatePicker.Show(_propertyItem.Value.Item1, newDate =>
{
DateTime newDateTime = new DateTime(
newDate.Year,
newDate.Month,
newDate.Day,
_propertyItem.Value.Item1.Hour,
_propertyItem.Value.Item1.Minute,
0
);
OnStartDateTimeSelected(newDateTime);
});
CursorManager.Instance.SetDefaultCursor();
Debug.LogWarning($"'{_propertyItem.Name}'의 시작 날짜/시간 선택기 로직이 구현되지 않았습니다.");
}
private void OpenEndDateTimePicker()
private async void OpenEndDateTimePicker()
{
DatePicker.Show(_propertyItem.Value2, OnEndDateTimeSelected);
CursorManager.Instance.SetDefaultCursor();
await DatePicker.Show(_propertyItem.Value.Item2, newDate =>
{
DateTime newDateTime = new DateTime(
newDate.Year,
newDate.Month,
newDate.Day,
_propertyItem.Value.Item2.Hour,
_propertyItem.Value.Item2.Minute,
0
);
OnEndDateTimeSelected(newDateTime);
});
CursorManager.Instance.SetDefaultCursor();
Debug.LogWarning($"'{_propertyItem.Name}'의 끝 날짜/시간 선택기 로직이 구현되지 않았습니다.");
}
private void OnStartDateTimeSelected(DateTime newStartDateTime)
{
var oldValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
//이전 값이랑 같으면 리턴
if (_propertyItem.Value.Item1.ToString(FullDateFormat) == newStartDateTime.ToString(FullDateFormat)) return;
DateTime Item1 = newStartDateTime;
DateTime Item2 = _propertyItem.Value.Item2;
// 시작 날짜/시간이 끝 날짜/시간보다 늦어지지 않도록 보정
if (newStartDateTime > _propertyItem.Value2)
{
_propertyItem.Value2 = newStartDateTime;
}
_propertyItem.Value = newStartDateTime;
if (newStartDateTime > Item2) Item2 = newStartDateTime;
var newValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
var newValue = new Tuple<DateTime, DateTime>(Item1, Item2);
// UI 업데이트
_startDateText.text = _propertyItem.Value.ToString(DateFormat);
_endDateText.text = _propertyItem.Value2.ToString(DateFormat);
_startDateText.text = Item1.ToString(DateFormat);
_endDateText.text = Item2.ToString(DateFormat);
_startHourDropDown.SetValueWithoutNotify(Item1.Hour);
_startMiniteDropDown.SetValueWithoutNotify(Item1.Minute);
_endHourDropDown.SetValueWithoutNotify(Item2.Hour);
_endMiniteDropDown.SetValueWithoutNotify(Item2.Minute);
// 변경 이벤트 알림
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
@@ -209,20 +250,26 @@ namespace UVC.UI.Window.PropertyWindow.UI
private void OnEndDateTimeSelected(DateTime newEndDateTime)
{
var oldValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
//이전 값이랑 같으면 리턴
if (_propertyItem.Value.Item2.ToString(FullDateFormat) == newEndDateTime.ToString(FullDateFormat)) return;
DateTime Item1 = _propertyItem.Value.Item1;
DateTime Item2 = newEndDateTime;
// 끝 날짜/시간이 시작 날짜/시간보다 빨라지지 않도록 보정
if (newEndDateTime < _propertyItem.Value)
{
_propertyItem.Value = newEndDateTime;
}
_propertyItem.Value2 = newEndDateTime;
if (newEndDateTime < Item1) Item1 = newEndDateTime;
var newValue = new Tuple<DateTime, DateTime>(_propertyItem.Value, _propertyItem.Value2);
var newValue = new Tuple<DateTime, DateTime>(Item1, Item2);
// UI 업데이트
_startDateText.text = _propertyItem.Value.ToString(DateFormat);
_endDateText.text = _propertyItem.Value2.ToString(DateFormat);
_startDateText.text = Item1.ToString(DateFormat);
_endDateText.text = Item2.ToString(DateFormat);
_startHourDropDown.SetValueWithoutNotify(Item1.Hour);
_startMiniteDropDown.SetValueWithoutNotify(Item1.Minute);
_endHourDropDown.SetValueWithoutNotify(Item2.Hour);
_endMiniteDropDown.SetValueWithoutNotify(Item2.Minute);
// 변경 이벤트 알림
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);

View File

@@ -37,7 +37,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is EnumProperty enumItem))
{
Debug.LogError("EnumPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"EnumPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -83,7 +83,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
// 읽기 전용 상태 설정
_dropdown.interactable = !_propertyItem.IsReadOnly;
// --- 이벤트 리스너 등록 ---
_dropdown.onValueChanged.RemoveAllListeners();
_dropdown.onValueChanged.AddListener(OnDropdownValueChanged);
@@ -100,6 +100,11 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
var newValue = _enumValues.GetValue(index);
if(newValue.Equals(_propertyItem.Value))
{
return; // 변경 사항이 없으므로 아무 작업도 하지 않음
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
}

View File

@@ -35,7 +35,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is ListProperty dropdownItem))
{
Debug.LogError("DropdownListPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"DropdownListPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -97,6 +97,11 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
string newValue = _propertyItem.ItemsSource[index];
if (newValue == _propertyItem.Value)
{
return; // 값이 변경되지 않았으므로 아무 작업도 하지 않음
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
}

View File

@@ -26,6 +26,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// </summary>
public void Setup(IPropertyItem item, PropertyWindow controller)
{
if (!(item is IntProperty) && !(item is FloatProperty))
{
Debug.LogError($"NumberPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
_propertyItem = item;
_controller = controller;
@@ -143,6 +149,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
_valueInput.text = "0";
}
}
if (_slider.gameObject.activeSelf)
{
// 슬라이더가 활성화된 경우 슬라이더 값도 동기화
@@ -161,6 +168,11 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
else
{
if (value.Equals(_propertyItem.GetValue()))
{
return;
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, value);
}
@@ -171,7 +183,11 @@ namespace UVC.UI.Window.PropertyWindow.UI
object v = value;
if (_propertyItem.PropertyType == PropertyType.Int)
{
v= (int)value;
v = (int)value;
}
if(v.Equals(_propertyItem.GetValue()))
{
return;
}
_valueInput.text = value.ToString();

View File

@@ -39,7 +39,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is IntRangeProperty intRangeItem) && !(item is FloatRangeProperty floatRange))
{
Debug.LogError("IntRangePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"IntRangePropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -72,8 +72,8 @@ namespace UVC.UI.Window.PropertyWindow.UI
_maxInputField.contentType = TMP_InputField.ContentType.IntegerNumber;
// 초기 값 설정
_minInputField.text = (_propertyItem as IntRangeProperty).Value.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = (_propertyItem as IntRangeProperty).Value2.ToString(CultureInfo.InvariantCulture);
_minInputField.text = (_propertyItem as IntRangeProperty).Value.Item1.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = (_propertyItem as IntRangeProperty).Value.Item2.ToString(CultureInfo.InvariantCulture);
}
else if (item.PropertyType == PropertyType.FloatRange)
{
@@ -81,8 +81,8 @@ namespace UVC.UI.Window.PropertyWindow.UI
_maxInputField.contentType = TMP_InputField.ContentType.DecimalNumber;
// 초기 값 설정
_minInputField.text = (_propertyItem as FloatRangeProperty).Value.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = (_propertyItem as FloatRangeProperty).Value2.ToString(CultureInfo.InvariantCulture);
_minInputField.text = (_propertyItem as FloatRangeProperty).Value.Item1.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = (_propertyItem as FloatRangeProperty).Value.Item2.ToString(CultureInfo.InvariantCulture);
}
@@ -129,26 +129,20 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 이전 값을 저장합니다.
var oldValue = new Vector2Int(propertyItem.Value, propertyItem.Value2);
var oldValue = new Vector2Int(propertyItem.Value.Item1, propertyItem.Value.Item2);
var newValue = new Vector2Int(newMin, newMax);
// 값이 변경되었는지 확인합니다.
if (oldValue == newValue)
{
// 값이 변경되지 않았으면 UI만 원래 값으로 복원하고 종료합니다.
_minInputField.text = propertyItem.Value.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = propertyItem.Value2.ToString(CultureInfo.InvariantCulture);
_minInputField.text = propertyItem.Value.Item1.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = propertyItem.Value.Item2.ToString(CultureInfo.InvariantCulture);
return;
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
// 범위 속성은 두 개의 값을 가지므로, 컨트롤러의 UpdatePropertyValue를 직접 사용하지 않고
// 속성 객체의 값을 직접 변경한 후, 변경 이벤트를 수동으로 발생시킵니다.
propertyItem.Value = newMin;
propertyItem.Value2 = newMax;
// 변경 이벤트를 발생시켜 다른 부분에 알립니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, new Tuple<int, int>(newMin, newMax));
// 보정된 값으로 UI를 다시 업데이트합니다.
_minInputField.text = newMin.ToString(CultureInfo.InvariantCulture);
@@ -168,26 +162,20 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 이전 값을 저장합니다.
var oldValue = new Vector2(propertyItem.Value, propertyItem.Value2);
var oldValue = new Vector2(propertyItem.Value.Item1, propertyItem.Value.Item2);
var newValue = new Vector2(newMin, newMax);
// 값이 변경되었는지 확인합니다.
if (oldValue == newValue)
{
// 값이 변경되지 않았으면 UI만 원래 값으로 복원하고 종료합니다.
_minInputField.text = propertyItem.Value.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = propertyItem.Value2.ToString(CultureInfo.InvariantCulture);
_minInputField.text = propertyItem.Value.Item1.ToString(CultureInfo.InvariantCulture);
_maxInputField.text = propertyItem.Value.Item2.ToString(CultureInfo.InvariantCulture);
return;
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
// 범위 속성은 두 개의 값을 가지므로, 컨트롤러의 UpdatePropertyValue를 직접 사용하지 않고
// 속성 객체의 값을 직접 변경한 후, 변경 이벤트를 수동으로 발생시킵니다.
propertyItem.Value = newMin;
propertyItem.Value2 = newMax;
// 변경 이벤트를 발생시켜 다른 부분에 알립니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, new Tuple<float, float>(newMin, newMax));
// 보정된 값으로 UI를 다시 업데이트합니다.
_minInputField.text = newMin.ToString(CultureInfo.InvariantCulture);

View File

@@ -39,7 +39,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is RadioGroupProperty radioItem))
{
Debug.LogError("RadioGroupPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"RadioGroupPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
if (_togglePrefab == null)
@@ -130,6 +130,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="selectedValue">선택된 토글에 해당하는 값</param>
private void OnToggleValueChanged(string selectedValue)
{
if(selectedValue == _propertyItem.Value)
{
return; // 값이 변경되지 않았으면 무시
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, selectedValue);
}

View File

@@ -16,7 +16,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
[SerializeField] private TextMeshProUGUI _descriptionLabel;
[SerializeField] private TMP_InputField _valueInput;
private IPropertyItem _propertyItem;
private StringProperty _propertyItem;
private PropertyWindow _controller;
/// <summary>
@@ -24,7 +24,14 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// </summary>
public void Setup(IPropertyItem item, PropertyWindow controller)
{
_propertyItem = item;
if (!(item is StringProperty typedItem))
{
Debug.LogError($"StringPropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
_propertyItem = typedItem;
_controller = controller;
// --- 데이터 바인딩 ---
@@ -49,7 +56,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
}
// 2. 값 설정
_valueInput.text = _propertyItem.GetValue() as string;
_valueInput.text = _propertyItem.Value;
// 3. 읽기 전용 상태 설정
_valueInput.interactable = !_propertyItem.IsReadOnly;
@@ -71,6 +78,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
/// <param name="newValue">InputField에 입력된 새로운 문자열</param>
private void OnValueSubmitted(string newValue)
{
if(newValue == _propertyItem.GetValue() as string)
{
// 값이 변경되지 않았으면 아무 작업도 하지 않음
return;
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
}

View File

@@ -41,7 +41,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is Vector2Property vector2Item))
{
Debug.LogError("Vector2PropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"Vector2PropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -100,6 +100,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
var newValue = new Vector2(x, y);
if(newValue == _propertyItem.Value)
{
// 값이 변경되지 않았으므로 업데이트하지 않음
return;
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
}

View File

@@ -46,7 +46,7 @@ namespace UVC.UI.Window.PropertyWindow.UI
{
if (!(item is Vector3Property vector3Item))
{
Debug.LogError("Vector3PropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다.");
Debug.LogError($"Vector3PropertyUI에 잘못된 타입의 PropertyItem이 전달되었습니다. {item.GetType()}");
return;
}
@@ -111,6 +111,12 @@ namespace UVC.UI.Window.PropertyWindow.UI
var newValue = new Vector3(x, y, z);
if(newValue == _propertyItem.Value)
{
// 값이 변경되지 않았으므로 업데이트할 필요가 없습니다.
return;
}
// 컨트롤러를 통해 모델의 값을 업데이트합니다.
_controller.UpdatePropertyValue(_propertyItem.Id, _propertyItem.PropertyType, newValue);
}