SideTabBar 기능 추가
This commit is contained in:
@@ -74,7 +74,7 @@ namespace UVC.Factory.Component
|
||||
/// <param name="data">수신된 데이터 객체 (DataArray 형태)</param>
|
||||
public void OnUpdateData(IDataObject data)
|
||||
{
|
||||
Debug.Log($"PORTManager OnUpdateData data == null:{data == null}");
|
||||
//Debug.Log($"PORTManager OnUpdateData data == null:{data == null}");
|
||||
if (data == null) return;
|
||||
|
||||
DataArray? arr = data as DataArray;
|
||||
@@ -87,7 +87,7 @@ namespace UVC.Factory.Component
|
||||
|
||||
var portsIds = new HashSet<string>(ports.Keys);
|
||||
|
||||
Debug.Log($"PORTManager received data: ports:{ports.Count} portsIds:{portsIds.Count} count:{arr.Count}, Added={AddedItems.Count}, Removed={RemovedItems.Count}, Modified={ModifiedList.Count}");
|
||||
//Debug.Log($"PORTManager received data: ports:{ports.Count} portsIds:{portsIds.Count} count:{arr.Count}, Added={AddedItems.Count}, Removed={RemovedItems.Count}, Modified={ModifiedList.Count}");
|
||||
|
||||
// 추가된 항목 처리
|
||||
foreach (var item in AddedItems)
|
||||
|
||||
8
Assets/Scripts/UVC/Factory/Tab.meta
Normal file
8
Assets/Scripts/UVC/Factory/Tab.meta
Normal file
@@ -0,0 +1,8 @@
|
||||
fileFormatVersion: 2
|
||||
guid: db7aa5f1738008e48a1fe0bfd0d43db6
|
||||
folderAsset: yes
|
||||
DefaultImporter:
|
||||
externalObjects: {}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
64
Assets/Scripts/UVC/Factory/Tab/SideTabBar.cs
Normal file
64
Assets/Scripts/UVC/Factory/Tab/SideTabBar.cs
Normal file
@@ -0,0 +1,64 @@
|
||||
#nullable enable
|
||||
using Cysharp.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UnityEngine.EventSystems;
|
||||
using UVC.Core;
|
||||
using UVC.UI.Tab;
|
||||
|
||||
namespace UVC.Factory.Tab
|
||||
{
|
||||
public class SideTabBar : SingletonScene<SideTabBar>, IPointerEnterHandler, IPointerExitHandler
|
||||
{
|
||||
[SerializeField]
|
||||
private TabController? tabController;
|
||||
|
||||
protected override void Init()
|
||||
{
|
||||
if (tabController == null)
|
||||
{
|
||||
Debug.LogError("SideTabBar: TabController가 할당되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
// 1. TabConfig 설정
|
||||
tabController?.AddTabConfig("Explorer", "탐색기", "Prefabs/UI/Tab/TabContentComponentList", "Prefabs/UI/images/icon_side_tab_explorer_128", "탐색기", true);
|
||||
tabController?.AddTabConfig("Library", "라이브러리", "Prefabs/UI/Tab/TabContentSample", "Prefabs/UI/images/icon_side_tab_library_128", "라이브러리", true);
|
||||
tabController?.AddTabConfig("ResourceExplorer", "자원 탐색기", "Prefabs/UI/Tab/TabContentSample", "Prefabs/UI/images/icon_side_tab_resource_128", "자원 탐색기", true);
|
||||
tabController?.AddTabConfig("FleetManager", "이동기 관리", "Prefabs/UI/Tab/TabContentSample", "Prefabs/UI/images/icon_side_tab_fleet_128", "이동기 관리", true);
|
||||
|
||||
// 2. 컨트롤러 초기화
|
||||
tabController?.Initialize();
|
||||
|
||||
if (tabController != null)
|
||||
{
|
||||
tabController.OnTabChanged += (index) =>
|
||||
{
|
||||
Debug.Log($"탭이 변경되었습니다: {index}");
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 마우스 포인터가 이 UI 요소의 영역 안으로 들어왔을 때 호출됩니다.
|
||||
/// UI와 상호작용하는 동안 3D 뷰의 카메라가 움직이지 않도록 컨트롤러를 비활성화합니다.
|
||||
/// </summary>
|
||||
public virtual void OnPointerEnter(PointerEventData eventData)
|
||||
{
|
||||
FactoryCameraController.Instance.Enable = false; // 카메라 컨트롤러 비활성화
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 마우스 포인터가 이 UI 요소의 영역 밖으로 나갔을 때 호출됩니다.
|
||||
/// 카메라 컨트롤을 다시 활성화하여 3D 뷰를 조작할 수 있도록 합니다.
|
||||
/// </summary>
|
||||
public virtual void OnPointerExit(PointerEventData eventData)
|
||||
{
|
||||
FactoryCameraController.Instance.Enable = true; // 카메라 컨트롤러 활성화
|
||||
}
|
||||
}
|
||||
}
|
||||
2
Assets/Scripts/UVC/Factory/Tab/SideTabBar.cs.meta
Normal file
2
Assets/Scripts/UVC/Factory/Tab/SideTabBar.cs.meta
Normal file
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f7ceed4820f862b49926a239f1461920
|
||||
116
Assets/Scripts/UVC/Factory/Tab/TabContentComponentList.cs
Normal file
116
Assets/Scripts/UVC/Factory/Tab/TabContentComponentList.cs
Normal file
@@ -0,0 +1,116 @@
|
||||
#nullable enable
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
using UVC.Factory.Component;
|
||||
using UVC.UI.Commands;
|
||||
using UVC.UI.List.ComponentList;
|
||||
using UVC.UI.Menu;
|
||||
using UVC.UI.Tab;
|
||||
|
||||
namespace UVC.Factory.Tab
|
||||
{
|
||||
public class TabContentComponentList : MonoBehaviour, ITabContent
|
||||
{
|
||||
|
||||
// [SerializeField]는 Unity 에디터의 Inspector 창에서 이 변수를 직접 연결할 수 있게 해줍니다.
|
||||
// 이 창이 실제로 제어할 리스트 UI 컴포넌트를 가리킵니다.
|
||||
[Tooltip("실제 데이터 리스트를 표시하는 ComponentList UI 컴포넌트입니다.")]
|
||||
[SerializeField]
|
||||
protected ComponentList? componentList = null;
|
||||
|
||||
/// <summary>
|
||||
/// 이 컴포넌트가 처음 초기화될 때 호출됩니다. (SingletonScene의 일부)
|
||||
/// 'componentList' 변수에 필요한 컴포넌트를 찾아 할당하는 역할을 합니다.
|
||||
/// </summary>
|
||||
protected void Start()
|
||||
{
|
||||
if (componentList == null)
|
||||
{
|
||||
componentList = GetComponentInChildren<ComponentList>();
|
||||
}
|
||||
|
||||
if (componentList == null)
|
||||
{
|
||||
Debug.LogError("InfiniteScroll component is not assigned or found in children.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 리스트에 표시할 데이터를 설정하고 UI를 구성합니다.
|
||||
/// FactoryObjectManager로부터 모든 객체 정보를 가져와 리스트에 넘겨줍니다.
|
||||
/// </summary>
|
||||
public void SetupData()
|
||||
{
|
||||
// 팩토리 내 모든 객체 정보를 카테고리별로 정렬하여 가져옵니다.
|
||||
var infos = FactoryObjectManager.Instance.GetFactoryObjectInfosByCategory();
|
||||
// 가져온 데이터를 ComponentList 컴포넌트에 전달하여 실제 UI 리스트를 생성하도록 합니다.
|
||||
componentList?.SetupData(infos);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// '필터' 버튼을 클릭했을 때 호출되는 메서드입니다.
|
||||
/// 사용자가 쉽게 검색할 수 있도록 도와주는 필터 키워드 메뉴를 보여줍니다.
|
||||
/// </summary>
|
||||
public void ShowFilter()
|
||||
{
|
||||
Debug.Log("필터 버튼 클릭됨.");
|
||||
|
||||
// 컨텍스트 메뉴에 표시할 항목들을 정의합니다.
|
||||
var menuItems = new List<ContextMenuItemData>
|
||||
{
|
||||
// "카테고리" 메뉴: 클릭 시 검색창에 "@Category "를 자동으로 입력해줍니다.
|
||||
// 생성자: (itemId, displayName, command, commandParameter)
|
||||
new ContextMenuItemData("Menu1", "카테고리", new ActionCommand(()=>{ componentList?.SetSearchText("@Category "); })),
|
||||
new ContextMenuItemData(isSeparator: true), // 구분선 추가
|
||||
new ContextMenuItemData("Menu2", "구역", new ActionCommand(()=>{ componentList?.SetSearchText("@Area "); })),
|
||||
new ContextMenuItemData(isSeparator: true), // 구분선 추가
|
||||
new ContextMenuItemData("Menu3", "층", new ActionCommand(()=>{ componentList?.SetSearchText("@Floor "); })),
|
||||
};
|
||||
|
||||
// ContextMenuManager를 통해 마우스 위치에 메뉴를 표시합니다.
|
||||
ContextMenuManager.Instance.ShowMenu(menuItems, Input.mousePosition);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// 새로고침 버튼 클릭 시 호출됩니다.
|
||||
/// 리스트의 모든 데이터를 지우고 SetupData를 다시 호출하여 목록을 갱신합니다.
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
var infos = FactoryObjectManager.Instance.GetFactoryObjectInfosByCategory();
|
||||
componentList?.SetupData(infos);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 탭 콘텐츠에 데이터를 전달합니다.
|
||||
/// </summary>
|
||||
/// <param name="data">전달할 데이터 객체</param>
|
||||
public void SetContentData(object? data)
|
||||
{
|
||||
Debug.Log("TabContentComponentList: SetContentData called");
|
||||
SetupData();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 탭 전환 시 데이터가 있는 경우 전달 되는 데이터. SetContentData 이후 호출 됨
|
||||
/// </summary>
|
||||
/// <param name="data">전달할 데이터 객체</param>
|
||||
public void UpdateContentData(object? data)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 닫힐 때 실행되는 로직을 처리합니다.
|
||||
/// </summary>
|
||||
/// <returns>비동기 닫기 작업을 나타내는 <see cref="UniTask"/>입니다.</returns>
|
||||
public UniTask OnCloseAsync()
|
||||
{
|
||||
Debug.Log("TabContentComponentList: OnClose called");
|
||||
return UniTask.CompletedTask;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 3ad4849178b5dba44bf6c769818a2be4
|
||||
Reference in New Issue
Block a user