UTKAccodion 완료. UTKComponentList 수정 중
This commit is contained in:
@@ -0,0 +1,20 @@
|
||||
<?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="UTKComponentListWindow" />
|
||||
<VisualElement name="component-list-window-container" class="utk-window-sample-container" />
|
||||
</VisualElement>
|
||||
|
||||
<!-- Code Sample -->
|
||||
<VisualElement class="utk-code-sample-container">
|
||||
<utk:UTKCodeBlock title="C#" code="// 1. 윈도우 참조 획득 var componentWindow = root.Q<UTKComponentListWindow>("component-window"); // 2. 윈도우 제목 및 닫기 버튼 설정 componentWindow.Title = "모델 리스트"; componentWindow.ShowCloseButton = true; // 3. 데이터 구성 - 카테고리와 아이템 var data = new List<UTKComponentListItemDataBase> { new UTKComponentListCategoryData { name = "캐릭터", isExpanded = true, children = new List<UTKComponentListItemDataBase> { new UTKComponentListItemData { name = "플레이어", ExternalKey = "player_001", IsVisible = true } } } }; componentWindow.SetData(data); // 4. 선택 이벤트 componentWindow.OnItemSelected = (items) => { foreach (var item in items) Debug.Log($"선택됨: {item.name}"); }; // 5. 가시성 변경 이벤트 (눈 아이콘) componentWindow.OnItemVisibilityChanged += (item, isVisible) => { FindGameObject(item.ExternalKey)?.SetActive(isVisible); }; // 6. 삭제 이벤트 (Delete 키) componentWindow.EnabledDeleteItem = true; componentWindow.OnItemDeleted = (item) => { componentWindow.DeleteItem(item); }; // 7. 윈도우 표시 componentWindow.Show();" />
|
||||
<utk:UTKCodeBlock title="UXML" code="<utk:UTKComponentListWindow name="component-window" />" />
|
||||
</VisualElement>
|
||||
</VisualElement>
|
||||
</UXML>
|
||||
Reference in New Issue
Block a user