Files
XRLib/Assets/Scripts/UVC/Factory/Tab/TabContentTabComponentList.cs
2025-09-26 18:08:07 +09:00

79 lines
2.4 KiB
C#

#nullable enable
using Cysharp.Threading.Tasks;
using UnityEngine;
using UVC.Factory.Component;
using UVC.UI.Tab;
namespace Assets.Scripts.UVC.Factory.Tab
{
public class TabContentTabComponentList : MonoBehaviour, ITabContent
{
[SerializeField]
private TabController? tabController;
protected void Awake()
{
if (tabController == null)
{
Debug.LogError("TabContentTabComponentList: TabController가 할당되지 않았습니다.");
return;
}
}
public void Start()
{
var infos = FactoryObjectManager.Instance.GetFactoryObjectInfosByCategory();
// 1. TabConfig 설정
tabController?.AddTabConfig("ALL", "ALL", "Prefabs/UI/Tab/TabContentComponentList", "", "ALL", true);
foreach (var info in infos)
{
//info.Key 카테고리 이름
tabController?.AddTabConfig(info.Key, info.Key, "Prefabs/UI/Tab/TabContentComponentList", "", info.Key, true);
}
// 2. 컨트롤러 초기화
tabController?.Initialize();
if (tabController != null)
{
tabController.OnTabChanged += (index) =>
{
Debug.Log($"탭이 변경되었습니다: {index}");
};
}
}
/// <summary>
/// 탭 콘텐츠에 데이터를 전달합니다.
/// </summary>
/// <param name="data">전달할 데이터 객체</param>
public void SetContentData(object? data)
{
Debug.Log("TabContentTabComponentList: SetContentData called");
}
/// <summary>
/// 탭 전환 시 데이터가 있는 경우 전달 되는 데이터. SetContentData 이후 호출 됨
/// </summary>
/// <param name="data">전달할 데이터 객체</param>
public void UpdateContentData(object? data)
{
}
/// <summary>
/// 닫힐 때 실행되는 로직을 처리합니다.
/// </summary>
/// <returns>비동기 닫기 작업을 나타내는 <see cref="UniTask"/>입니다.</returns>
public UniTask OnCloseAsync()
{
Debug.Log("TabContentTabComponentList: OnClose called");
return UniTask.CompletedTask;
}
}
}