21 lines
2.5 KiB
XML
21 lines
2.5 KiB
XML
<?xml version="1.0" encoding="utf-8"?>
|
|
<UXML xmlns="UnityEngine.UIElements" xmlns:utk="UVC.UIToolkit">
|
|
<Style src="../UTKSampleCommon.uss" />
|
|
<Style src="UTKWindowSample.uss" />
|
|
|
|
<VisualElement class="utk-sample-container">
|
|
<Label class="utk-sample-desc" text="이미지 그리드 리스트를 윈도우 형태로 래핑한 컴포넌트입니다. 썸네일 이미지와 드래그 앤 드롭 기능을 제공합니다." />
|
|
|
|
<VisualElement class="utk-sample-section">
|
|
<Label class="utk-sample-section__title" text="UTKImageListWindow" />
|
|
<VisualElement name="image-list-window-container" class="utk-window-sample-container" />
|
|
</VisualElement>
|
|
|
|
<!-- Code Sample -->
|
|
<VisualElement class="utk-code-sample-container">
|
|
<utk:UTKCodeBlock title="C#" code="// 1. 윈도우 참조 획득 var imageWindow = root.Q<UTKImageListWindow>("image-window"); // 2. 윈도우 제목 설정 imageWindow.Title = "텍스처 라이브러리"; imageWindow.ShowCloseButton = true; // 3. 데이터 구성 var data = new List<UTKImageListItemData> { new UTKImageListItemData { itemName = "Texture_01", imagePath = "Textures/texture_01", externalId = "tex_001" }, new UTKImageListItemData { itemName = "Texture_02", imagePath = "Textures/texture_02", externalId = "tex_002" } }; imageWindow.SetData(data); // 4. 클릭 이벤트 imageWindow.OnItemClicked = (item) => { Debug.Log($"클릭: {item.itemName}"); }; // 5. 드래그 앤 드롭 이벤트 imageWindow.OnItemBeginDrag += (item, screenPos) => { Debug.Log($"드래그 시작: {item.itemName}"); }; imageWindow.OnItemDrop += (item) => { Debug.Log($"드롭: {item.itemName}"); }; // 6. 리스트 영역 벗어남 감지 imageWindow.OnDragExitList += (item, screenPos) => { Show3DPreview(item.externalId); }; // 7. 드래그 고스트 표시 imageWindow.ShowDragGhost = true; // 8. 아이템 추가/삭제 imageWindow.AddItem(newItem); imageWindow.RemoveItem(item);" />
|
|
<utk:UTKCodeBlock title="UXML" code="<utk:UTKImageListWindow name="image-window" />" />
|
|
</VisualElement>
|
|
</VisualElement>
|
|
</UXML>
|