Files
XRLib/Assets/Resources/UIToolkit/Sample/Window/UTKImageListWindowSample.uxml
2026-01-22 20:12:22 +09:00

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. 윈도우 참조 획득&#10;var imageWindow = root.Q&lt;UTKImageListWindow&gt;(&quot;image-window&quot;);&#10;&#10;// 2. 윈도우 제목 설정&#10;imageWindow.Title = &quot;텍스처 라이브러리&quot;;&#10;imageWindow.ShowCloseButton = true;&#10;&#10;// 3. 데이터 구성&#10;var data = new List&lt;UTKImageListItemData&gt;&#10;{&#10; new UTKImageListItemData&#10; {&#10; itemName = &quot;Texture_01&quot;,&#10; imagePath = &quot;Textures/texture_01&quot;,&#10; externalId = &quot;tex_001&quot;&#10; },&#10; new UTKImageListItemData&#10; {&#10; itemName = &quot;Texture_02&quot;,&#10; imagePath = &quot;Textures/texture_02&quot;,&#10; externalId = &quot;tex_002&quot;&#10; }&#10;};&#10;imageWindow.SetData(data);&#10;&#10;// 4. 클릭 이벤트&#10;imageWindow.OnItemClicked = (item) =&gt;&#10;{&#10; Debug.Log($&quot;클릭: {item.itemName}&quot;);&#10;};&#10;&#10;// 5. 드래그 앤 드롭 이벤트&#10;imageWindow.OnItemBeginDrag += (item, screenPos) =&gt;&#10;{&#10; Debug.Log($&quot;드래그 시작: {item.itemName}&quot;);&#10;};&#10;&#10;imageWindow.OnItemDrop += (item) =&gt;&#10;{&#10; Debug.Log($&quot;드롭: {item.itemName}&quot;);&#10;};&#10;&#10;// 6. 리스트 영역 벗어남 감지&#10;imageWindow.OnDragExitList += (item, screenPos) =&gt;&#10;{&#10; Show3DPreview(item.externalId);&#10;};&#10;&#10;// 7. 드래그 고스트 표시&#10;imageWindow.ShowDragGhost = true;&#10;&#10;// 8. 아이템 추가/삭제&#10;imageWindow.AddItem(newItem);&#10;imageWindow.RemoveItem(item);" />
<utk:UTKCodeBlock title="UXML" code="&lt;utk:UTKImageListWindow name=&quot;image-window&quot; /&gt;" />
</VisualElement>
</VisualElement>
</UXML>