using System.Collections.Generic; using UnityEngine; using UVC.UI.Commands; using UVC.UI.List.ComponentList; using UVC.UI.Menu; using UVC.UI.Window; public class ComponentListWindowSample : MonoBehaviour { [SerializeField] private ComponentListWindow componentListWindow; [SerializeField] private ComponentListTabWindow componentListTabWindow; // Start is called once before the first execution of Update after the MonoBehaviour is created void Start() { var info = ComponentList.GenerateData(); if(componentListWindow != null) { componentListWindow.SetupData(info); componentListWindow.OnClickItem += (itemData) => { Debug.Log($"아이템 클릭: {itemData.Name} (ID: {itemData.Id})"); }; componentListWindow.OnCategoryExpand += (itemData) => { Debug.Log($"카테고리 확장/축소: {itemData.Name}, IsExpanded: {itemData.IsExpanded}"); }; componentListWindow.OnSettingButtonClick += (itemData) => { Debug.Log($"설정 버튼 클릭: {itemData.CategoryName}"); }; componentListWindow.OnVisibleChanged += (itemData, isVisible) => { Debug.Log($"보이기/숨기기 버튼 클릭: {itemData.Name}, IsVisible: {isVisible}"); }; componentListWindow.OnFindButtonClick += (itemData) => { Debug.Log($"검색/이동 버튼 클릭: {itemData.Name}"); }; componentListWindow.OnRefreshButtonClick += () => { Debug.Log("리프레시 버튼 클릭"); var refreshedInfo = ComponentList.GenerateData(); componentListWindow.SetupData(refreshedInfo); }; componentListWindow.OnRightClickItem += (itemData) => { Debug.Log($"아이템 오른쪽 클릭: {itemData.Name} (ID: {itemData.Id})"); // 컨텍스트 메뉴에 표시할 항목들을 정의합니다. var menuItems = new List { // "카테고리" 메뉴: 클릭 시 검색창에 "@Category "를 자동으로 입력해줍니다. // 생성자: (itemId, displayName, command, commandParameter) new ContextMenuItemData("Menu1", "카테고리", new DebugLogCommand($"카테고리 필터 선택됨: {itemData.Name}")), new ContextMenuItemData(isSeparator: true), // 구분선 추가 new ContextMenuItemData("Menu2", "구역", new DebugLogCommand("구역 필터 선택됨")), new ContextMenuItemData(isSeparator: true), // 구분선 추가 new ContextMenuItemData("Menu3", "층", new DebugLogCommand("층 필터 선택됨")), }; // ContextMenuManager를 통해 마우스 위치에 메뉴를 표시합니다. ContextMenuManager.Instance.ShowMenu(menuItems, Input.mousePosition); }; } if(componentListTabWindow != null) { componentListTabWindow.SetupData(info); } } }