UTKNotification 수정 중
This commit is contained in:
@@ -484,6 +484,9 @@ treeWindow.Show();");
|
||||
|
||||
container.Add(propertyWindow);
|
||||
|
||||
// PropertyTabListWindow 샘플도 함께 초기화 (동일 UXML 내)
|
||||
InitializePropertyTabListWindowSample(root);
|
||||
|
||||
SetCodeSamples(root,
|
||||
csharpCode: @"// 속성 윈도우 생성
|
||||
var propertyWindow = new UTKPropertyListWindow();
|
||||
@@ -547,6 +550,87 @@ propertyWindow.Show();",
|
||||
</UXML>");
|
||||
}
|
||||
|
||||
private void InitializePropertyTabListWindowSample(VisualElement root)
|
||||
{
|
||||
var container = root.Q<VisualElement>("property-tab-list-window-container");
|
||||
if (container == null) return;
|
||||
|
||||
var tabWindow = new UTKPropertyTabListWindow("속성 탭 편집기", showAllTab: true);
|
||||
tabWindow.ShowCloseButton = true;
|
||||
tabWindow.style.width = 320;
|
||||
tabWindow.style.height = 600;
|
||||
|
||||
// 이벤트 구독
|
||||
tabWindow.OnCloseClicked += () =>
|
||||
{
|
||||
Debug.Log("PropertyTabListWindow Close clicked");
|
||||
};
|
||||
|
||||
tabWindow.OnTabChanged += (index, tabData) =>
|
||||
{
|
||||
Debug.Log($"Tab Changed: index={index}, name={tabData?.Name}");
|
||||
};
|
||||
|
||||
tabWindow.OnPropertyValueChanged += args =>
|
||||
{
|
||||
Debug.Log($"Property Changed: {args.PropertyId} = {args.NewValue}");
|
||||
};
|
||||
|
||||
// ===== 탭 1: 기본 속성 (Flat) =====
|
||||
var generalTab = new TabPropertyData("일반");
|
||||
generalTab.SetFlatData(new List<IUTKPropertyItem>
|
||||
{
|
||||
new UTKStringPropertyItem("name", "Name", "Sample Object"),
|
||||
new UTKBoolPropertyItem("active", "Is Active", true),
|
||||
new UTKIntPropertyItem("count", "Count", 10, 0, 100, useSlider: true),
|
||||
new UTKFloatPropertyItem("speed", "Speed", 1.5f, 0f, 10f, useSlider: true, useStepper: true),
|
||||
new UTKDropdownPropertyItem("type", "Type",
|
||||
new List<string> { "Static", "Dynamic", "Kinematic" }, "Static"),
|
||||
});
|
||||
|
||||
// ===== 탭 2: Transform (Grouped) =====
|
||||
var transformTab = new TabPropertyData("트랜스폼");
|
||||
var posGroup = new UTKPropertyGroup("position", "Position");
|
||||
posGroup.AddItem(new UTKVector3PropertyItem("pos", "Position", Vector3.zero));
|
||||
posGroup.AddItem(new UTKVector3PropertyItem("rot", "Rotation", Vector3.zero));
|
||||
posGroup.AddItem(new UTKVector3PropertyItem("scl", "Scale", Vector3.one));
|
||||
|
||||
var physicsGroup = new UTKPropertyGroup("physics", "Physics");
|
||||
physicsGroup.AddItem(new UTKFloatPropertyItem("mass", "Mass", 1.0f, 0f, 100f, useSlider: true));
|
||||
physicsGroup.AddItem(new UTKBoolPropertyItem("gravity", "Use Gravity", true));
|
||||
physicsGroup.AddItem(new UTKDropdownPropertyItem("collision", "Collision",
|
||||
new List<string> { "Discrete", "Continuous", "ContinuousDynamic" }, "Discrete"));
|
||||
|
||||
transformTab.SetGroupedData(new List<IUTKPropertyGroup> { posGroup, physicsGroup });
|
||||
|
||||
// ===== 탭 3: 외형 (Mixed) =====
|
||||
var appearanceTab = new TabPropertyData("외형");
|
||||
var mixedEntries = new List<IUTKPropertyEntry>
|
||||
{
|
||||
new UTKColorPropertyItem("mainColor", "Main Color", Color.blue),
|
||||
new UTKColorPropertyItem("emissionColor", "Emission", Color.yellow, useAlpha: true),
|
||||
new UTKFloatPropertyItem("alpha", "Alpha", 1f, 0f, 1f, useSlider: true),
|
||||
};
|
||||
|
||||
var materialGroup = new UTKPropertyGroup("material", "Material");
|
||||
materialGroup.AddItem(new UTKStringPropertyItem("shader", "Shader", "Standard"));
|
||||
materialGroup.AddItem(new UTKDropdownPropertyItem("renderQueue", "Render Queue",
|
||||
new List<string> { "Geometry", "AlphaTest", "Transparent" }, "Geometry"));
|
||||
mixedEntries.Add(materialGroup);
|
||||
|
||||
appearanceTab.SetMixedData(mixedEntries);
|
||||
|
||||
// ===== 탭 4: 비활성 탭 =====
|
||||
var disabledTab = new TabPropertyData("비활성") { IsEnabled = false, Tooltip = "이 탭은 비활성 상태입니다" };
|
||||
disabledTab.SetFlatData(new List<IUTKPropertyItem>());
|
||||
|
||||
// 탭 데이터 설정
|
||||
tabWindow.SetTabData(new List<TabPropertyData> { generalTab, transformTab, appearanceTab, disabledTab });
|
||||
tabWindow.Show();
|
||||
|
||||
container.Add(tabWindow);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 모든 PropertyItem 종류를 포함하는 샘플 데이터를 생성합니다.
|
||||
/// </summary>
|
||||
|
||||
Reference in New Issue
Block a user