UTKFloatStepper 추가. UTKFloatPropertyItem, UTKFloatPropertyItemView에 추가

This commit is contained in:
logonkhi
2026-02-09 20:28:09 +09:00
parent a38efd756e
commit 97bbb789ed
65 changed files with 2785 additions and 131 deletions

View File

@@ -82,6 +82,16 @@ namespace UVC.Sample.UIToolkit
Debug.Log($"Property Changed: {args.PropertyId} {args.PropertyName} ({args.PropertyType}) = {args.NewValue}");
};
_propertyWindow.OnPropertyClicked += args =>
{
Debug.Log($"Property Clicked: {args.Id} {args.DisplayName} ({args.PropertyType})");
};
_propertyWindow.OnPropertyButtonClicked += (id, actionName) =>
{
Debug.Log($"Button Clicked: {id} - Action: {actionName}");
};
// 샘플 데이터 생성
var entries = CreateSampleEntries();
_propertyWindow.LoadMixedProperties(entries);
@@ -94,17 +104,41 @@ namespace UVC.Sample.UIToolkit
var entries = new List<IUTKPropertyEntry>();
// ===== Group에 속하지 않은 개별 아이템들 =====
// String (편집 가능)
entries.Add(new UTKStringPropertyItem("string", "String", "Editable text"));
// String with Action Button
var stringWithButton = new UTKStringPropertyItem("string_with_btn", "String Button", "Click the button");
stringWithButton.ActionButton = new UTKButtonItem("btn_string_action", "string_action", "", UTKMaterialIcons.Search,
UTKButton.ButtonVariant.OutlineNormal, UTKButton.ButtonSize.Small);
stringWithButton.ActionButton.IconOnly = true;
stringWithButton.ActionButton.IconSize = 14;
entries.Add(stringWithButton);
var stringWithButton2 = new UTKStringPropertyItem("string_with_btn2", "String Button2", "Click the button");
stringWithButton2.ActionButton = new UTKButtonItem("btn_string_action", "string_action", "Search", UTKMaterialIcons.Search,
UTKButton.ButtonVariant.OutlineNormal, UTKButton.ButtonSize.Small);
stringWithButton2.ActionButton.IconSize = 14;
entries.Add(stringWithButton2);
// String (ShowLabel = false, 전체 너비)
var stringNoLabel = new UTKStringPropertyItem("string_no_label", "No Label String", "Full width input");
stringNoLabel.ShowLabel = false;
entries.Add(stringNoLabel);
// String (읽기 전용)
var roString = new UTKStringPropertyItem("string_ro", "String (RO)", "Read-only text", isReadOnly: true);
entries.Add(roString);
// Bool (편집 가능)
entries.Add(new UTKBoolPropertyItem("bool", "Bool", true));
// Bool (ShowLabel = false)
var boolNoLabel = new UTKBoolPropertyItem("bool_no_label", "No Label Bool", false);
boolNoLabel.ShowLabel = false;
entries.Add(boolNoLabel);
// Bool (읽기 전용)
var roBool = new UTKBoolPropertyItem("bool_ro", "Bool (RO)", true);
roBool.IsReadOnly = true;
@@ -112,7 +146,12 @@ namespace UVC.Sample.UIToolkit
// Int (편집 가능)
entries.Add(new UTKIntPropertyItem("int", "Int", 42, 0, 100));
// Int (ShowLabel = false)
var intNoLabel = new UTKIntPropertyItem("int_no_label", "No Label Int", 75, 0, 100);
intNoLabel.ShowLabel = false;
entries.Add(intNoLabel);
// Int (읽기 전용)
entries.Add(new UTKIntPropertyItem("int_ro", "Int (RO)", 99, 0, 100, isReadOnly: true));
@@ -134,13 +173,24 @@ namespace UVC.Sample.UIToolkit
// Int stepper (읽기 전용)
entries.Add(new UTKIntPropertyItem("int3_ro", "Int3 (RO)", 99, 0, 100, true, true, isReadOnly: true));
// Float (편집 가능)
entries.Add(new UTKFloatPropertyItem("float", "Float", 3.14f, 0f, 10f, true));
// Float (읽기 전용)
var roFloat = new UTKFloatPropertyItem("float_ro", "Float (RO)", 2.71f, 0f, 10f, true);
roFloat.IsReadOnly = true;
entries.Add(roFloat);
// Float (useSlider=true, useStepper=true)
entries.Add(new UTKFloatPropertyItem("float1", "Float (Slider+Stepper)", 3.14f, 0f, 10f, useSlider: true, useStepper: true));
// Float (useSlider=true, useStepper=false)
entries.Add(new UTKFloatPropertyItem("float2", "Float (Slider)", 5.0f, 0f, 10f, useSlider: true, useStepper: false));
// Float (useSlider=false, useStepper=true)
var floatStepper = new UTKFloatPropertyItem("float3", "Float (Stepper)", 2.5f, 0f, 10f, useSlider: false, useStepper: true)
{
Step = 0.5f // 0.5씩 증감
};
entries.Add(floatStepper);
// Float (useSlider=false, useStepper=false)
entries.Add(new UTKFloatPropertyItem("float4", "Float (Field)", 7.2f, 0f, 10f, useSlider: false, useStepper: false));
// Float (ReadOnly=true)
entries.Add(new UTKFloatPropertyItem("float_ro", "Float (ReadOnly)", 2.71f, 0f, 10f, useSlider: true, useStepper: false, isReadOnly: true));
// Vector2 (편집 가능)
entries.Add(new UTKVector2PropertyItem("vec2", "Vector2", new Vector2(1, 2)));
@@ -217,15 +267,27 @@ namespace UVC.Sample.UIToolkit
entries.Add(roEnum);
// Dropdown (편집 가능)
entries.Add(new UTKDropdownPropertyItem("dropdown", "Dropdown",
entries.Add(new UTKDropdownPropertyItem("dropdown", "Dropdown",
new List<string> { "Option A", "Option B", "Option C" }, "Option A"));
// Dropdown (읽기 전용)
var roDropdown = new UTKDropdownPropertyItem("dropdown_ro", "Dropdown (RO)",
var roDropdown = new UTKDropdownPropertyItem("dropdown_ro", "Dropdown (RO)",
new List<string> { "Option X", "Option Y", "Option Z" }, "Option Y");
roDropdown.IsReadOnly = true;
entries.Add(roDropdown);
// MultiSelectDropdown (편집 가능)
entries.Add(new UTKMultiSelectDropdownPropertyItem("multiselect", "MultiSelect",
new List<string> { "Tag1", "Tag2", "Tag3", "Tag4" },
new List<string> { "Tag1", "Tag3" }));
// MultiSelectDropdown (읽기 전용)
var roMultiSelect = new UTKMultiSelectDropdownPropertyItem("multiselect_ro", "MultiSelect (RO)",
new List<string> { "Feature A", "Feature B", "Feature C", "Feature D" },
new List<string> { "Feature B", "Feature C" });
roMultiSelect.IsReadOnly = true;
entries.Add(roMultiSelect);
// Radio (편집 가능)
entries.Add(new UTKRadioPropertyItem("radio", "Radio",
new List<string> { "Choice 1", "Choice 2", "Choice 3" }, 0));
@@ -261,6 +323,15 @@ namespace UVC.Sample.UIToolkit
// 기본 속성 그룹 (편집 가능)
var basicGroup = new UTKPropertyGroup("basic", "Basic Properties (Editable)");
basicGroup.AddItem(new UTKStringPropertyItem("name", "Name", "Sample Object"));
// String with Edit Button
var pathItem = new UTKStringPropertyItem("path", "File Path", "C:/Users/Sample/file.txt");
pathItem.ActionButton = new UTKButtonItem("btn_browse", "browse_file", "", UTKMaterialIcons.FolderOpen,
UTKButton.ButtonVariant.OutlineNormal, UTKButton.ButtonSize.Small);
pathItem.ActionButton.IconOnly = true;
pathItem.ActionButton.IconSize = 14;
basicGroup.AddItem(pathItem);
basicGroup.AddItem(new UTKStringPropertyItem("description", "Description", "This is a sample object") { IsMultiline = true });
basicGroup.AddItem(new UTKBoolPropertyItem("active", "Is Active", true));
basicGroup.AddItem(new UTKIntPropertyItem("count", "Count", 10, 0, 100, true));
@@ -363,6 +434,9 @@ namespace UVC.Sample.UIToolkit
selectionGroup.AddItem(new UTKEnumPropertyItem("layer", "Layer", SampleLayer.Default));
selectionGroup.AddItem(new UTKDropdownPropertyItem("tag", "Tag",
new List<string> { "Untagged", "Player", "Enemy", "Item", "Environment" }, "Player"));
selectionGroup.AddItem(new UTKMultiSelectDropdownPropertyItem("categories", "Categories",
new List<string> { "Physics", "Rendering", "Audio", "UI", "Network" },
new List<string> { "Physics", "Rendering" }));
selectionGroup.AddItem(new UTKRadioPropertyItem("quality", "Quality",
new List<string> { "Low", "Medium", "High", "Ultra" }, 2));
entries.Add(selectionGroup);
@@ -376,6 +450,11 @@ namespace UVC.Sample.UIToolkit
new List<string> { "Untagged", "Player", "Enemy", "Item", "Environment" }, "Enemy");
roTag.IsReadOnly = true;
selectionGroupRO.AddItem(roTag);
var roCategories = new UTKMultiSelectDropdownPropertyItem("categories_ro", "Categories",
new List<string> { "Physics", "Rendering", "Audio", "UI", "Network" },
new List<string> { "Audio", "UI", "Network" });
roCategories.IsReadOnly = true;
selectionGroupRO.AddItem(roCategories);
var roQuality = new UTKRadioPropertyItem("quality_ro", "Quality",
new List<string> { "Low", "Medium", "High", "Ultra" }, 3);
roQuality.IsReadOnly = true;
@@ -398,6 +477,75 @@ namespace UVC.Sample.UIToolkit
rangeGroupRO.AddItem(roDamageRange);
entries.Add(rangeGroupRO);
// Button 그룹 (라벨 표시 - ShowLabel = true, 기본값)
var buttonGroup = new UTKPropertyGroup("buttons", "Buttons (With Label)");
// Primary 버튼
buttonGroup.AddItem(new UTKButtonItem("btn_save", "save", "Save", UTKMaterialIcons.Save,
UTKButton.ButtonVariant.Primary, UTKButton.ButtonSize.Medium));
// Normal 버튼
buttonGroup.AddItem(new UTKButtonItem("btn_load", "load", "Load", UTKMaterialIcons.Download,
UTKButton.ButtonVariant.Normal, UTKButton.ButtonSize.Medium));
// Danger 버튼
buttonGroup.AddItem(new UTKButtonItem("btn_delete", "delete", "Delete", UTKMaterialIcons.Delete,
UTKButton.ButtonVariant.Danger, UTKButton.ButtonSize.Medium));
// Icon Only 버튼
var iconOnlyBtn = new UTKButtonItem("btn_settings", "settings", "", UTKMaterialIcons.Settings,
UTKButton.ButtonVariant.OutlinePrimary, UTKButton.ButtonSize.Medium);
iconOnlyBtn.IconOnly = true;
iconOnlyBtn.IconSize = 16;
buttonGroup.AddItem(iconOnlyBtn);
// Text 버튼
buttonGroup.AddItem(new UTKButtonItem("btn_help", "help", "Help", UTKMaterialIcons.Help,
UTKButton.ButtonVariant.Text, UTKButton.ButtonSize.Medium));
entries.Add(buttonGroup);
// Button 그룹 (라벨 없음 - ShowLabel = false, 전체 너비 사용)
var buttonGroupNoLabel = new UTKPropertyGroup("buttons_no_label", "Buttons (No Label)");
// Primary 버튼 (전체 너비)
var btnSaveNoLabel = new UTKButtonItem("btn_save_no_label", "save_no_label", "Save Changes", UTKMaterialIcons.Save,
UTKButton.ButtonVariant.Primary, UTKButton.ButtonSize.Medium);
btnSaveNoLabel.ShowLabel = false;
buttonGroupNoLabel.AddItem(btnSaveNoLabel);
// Normal 버튼 (전체 너비)
var btnLoadNoLabel = new UTKButtonItem("btn_load_no_label", "load_no_label", "Load Data", UTKMaterialIcons.Download,
UTKButton.ButtonVariant.Normal, UTKButton.ButtonSize.Medium);
btnLoadNoLabel.ShowLabel = false;
buttonGroupNoLabel.AddItem(btnLoadNoLabel);
// Danger 버튼 (전체 너비)
var btnDeleteNoLabel = new UTKButtonItem("btn_delete_no_label", "delete_no_label", "Delete All", UTKMaterialIcons.Delete,
UTKButton.ButtonVariant.Danger, UTKButton.ButtonSize.Medium);
btnDeleteNoLabel.ShowLabel = false;
buttonGroupNoLabel.AddItem(btnDeleteNoLabel);
entries.Add(buttonGroupNoLabel);
// Individual Button Items (라벨 표시)
entries.Add(new UTKButtonItem("btn_apply", "apply", "Apply Changes", UTKMaterialIcons.Check,
UTKButton.ButtonVariant.Primary, UTKButton.ButtonSize.Medium));
entries.Add(new UTKButtonItem("btn_reset", "reset", "Reset to Default", UTKMaterialIcons.Refresh,
UTKButton.ButtonVariant.OutlineNormal, UTKButton.ButtonSize.Medium));
// Individual Button Items (라벨 없음 - 전체 너비)
var btnConfirmNoLabel = new UTKButtonItem("btn_confirm_no_label", "confirm_no_label", "Confirm Action", UTKMaterialIcons.CheckCircle,
UTKButton.ButtonVariant.Primary, UTKButton.ButtonSize.Medium);
btnConfirmNoLabel.ShowLabel = false;
entries.Add(btnConfirmNoLabel);
var btnCancelNoLabel = new UTKButtonItem("btn_cancel_no_label", "cancel_no_label", "Cancel Operation", UTKMaterialIcons.Cancel,
UTKButton.ButtonVariant.OutlineNormal, UTKButton.ButtonSize.Medium);
btnCancelNoLabel.ShowLabel = false;
entries.Add(btnCancelNoLabel);
return entries;
}