스타일 가이드 적용 완료. UTKCOlorPicker, UTKDatePicker 확인해야 함
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
#nullable enable
|
||||
using System;
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.UIElements;
|
||||
using UVC.UIToolkit.Modal;
|
||||
@@ -105,7 +106,7 @@ namespace UVC.Sample.UIToolkit
|
||||
alphaRow.style.marginBottom = 15;
|
||||
|
||||
_useAlphaToggle = new Toggle("Use Alpha Channel");
|
||||
_useAlphaToggle.value = false;
|
||||
_useAlphaToggle.value = true;
|
||||
_useAlphaToggle.style.color = Color.white;
|
||||
alphaRow.Add(_useAlphaToggle);
|
||||
|
||||
@@ -117,6 +118,12 @@ namespace UVC.Sample.UIToolkit
|
||||
openPickerBtn.style.marginBottom = 10;
|
||||
container.Add(openPickerBtn);
|
||||
|
||||
// Async 버튼
|
||||
var openPickerAsyncBtn = new Button(() => OpenColorPickerAsync().Forget()) { text = "Open Color Picker (Async)" };
|
||||
openPickerAsyncBtn.style.height = 32;
|
||||
openPickerAsyncBtn.style.marginBottom = 10;
|
||||
container.Add(openPickerAsyncBtn);
|
||||
|
||||
// 프리셋 색상 버튼들
|
||||
var presetLabel = new Label("Preset Colors:");
|
||||
presetLabel.style.color = Color.white;
|
||||
@@ -162,6 +169,30 @@ namespace UVC.Sample.UIToolkit
|
||||
_currentPicker.OnColorSelected += OnColorSelected;
|
||||
}
|
||||
|
||||
private async UniTaskVoid OpenColorPickerAsync()
|
||||
{
|
||||
if (_root == null) return;
|
||||
|
||||
bool useAlpha = _useAlphaToggle?.value ?? true;
|
||||
|
||||
// ShowAsync를 사용하여 색상 선택 대기
|
||||
// OK 클릭 시 선택된 색상 반환, 취소/닫기 시 _currentColor 반환
|
||||
Color selectedColor = await UTKColorPicker.ShowAsync(_root, _currentColor, "Select Color (Async)", useAlpha);
|
||||
|
||||
// 결과 처리
|
||||
_currentColor = selectedColor;
|
||||
if (_colorPreview != null)
|
||||
{
|
||||
_colorPreview.style.backgroundColor = selectedColor;
|
||||
}
|
||||
if (_colorLabel != null)
|
||||
{
|
||||
_colorLabel.text = ColorToHex(selectedColor);
|
||||
}
|
||||
|
||||
Debug.Log($"[Async] Color Result: {ColorToHex(selectedColor)}");
|
||||
}
|
||||
|
||||
private void OnColorChanged(Color color)
|
||||
{
|
||||
// 실시간 미리보기 업데이트
|
||||
|
||||
Reference in New Issue
Block a user