Asset Library 기능 추가
This commit is contained in:
@@ -27,7 +27,7 @@ namespace UVC.Factory.Tab
|
||||
{
|
||||
// 1. TabConfig 설정
|
||||
tabController?.AddTabConfig("Explorer", "탐색기", "Prefabs/UI/Tab/TabContentTabComponentList", "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("Library", "라이브러리", "Prefabs/UI/Tab/TabContentPrefabGrid", "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);
|
||||
|
||||
|
||||
112
Assets/Scripts/UVC/Factory/Tab/TabContentPrefabGrid.cs
Normal file
112
Assets/Scripts/UVC/Factory/Tab/TabContentPrefabGrid.cs
Normal file
@@ -0,0 +1,112 @@
|
||||
using Cysharp.Threading.Tasks;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
#nullable enable
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using UnityEngine;
|
||||
using UVC.UI.List;
|
||||
using UVC.UI.List.ComponentList;
|
||||
using UVC.UI.Tab;
|
||||
using static UnityEditor.PlayerSettings;
|
||||
|
||||
namespace UVC.Factory.Tab
|
||||
{
|
||||
public class TabContentPrefabGrid : MonoBehaviour, ITabContent
|
||||
{
|
||||
[SerializeField]
|
||||
private PrefabGrid? prefabGrid;
|
||||
|
||||
protected void Awake()
|
||||
{
|
||||
if (prefabGrid == null)
|
||||
{
|
||||
prefabGrid = GetComponentInChildren<PrefabGrid>();
|
||||
}
|
||||
|
||||
if (prefabGrid == null)
|
||||
{
|
||||
Debug.LogError("InfiniteScroll component is not assigned or found in children.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void Start()
|
||||
{
|
||||
SetupData();
|
||||
}
|
||||
|
||||
|
||||
public void SetupData()
|
||||
{
|
||||
|
||||
List<string> imagePath = new List<string>()
|
||||
{
|
||||
"Images/lib_forklift_400x300",
|
||||
"Images/lib_pallet_400x300",
|
||||
"Images/lib_worker_400x300",
|
||||
};
|
||||
|
||||
List<string> prefabPath = new List<string>()
|
||||
{
|
||||
"Prefabs/Forklift",
|
||||
"Prefabs/PalletEmpty",
|
||||
"Prefabs/Male Young Guy",
|
||||
};
|
||||
|
||||
List<PrefabGridItemData> list = new List<PrefabGridItemData>();
|
||||
|
||||
for (int i = 0; i < 20; i++)
|
||||
{
|
||||
list.Add(new PrefabGridItemData()
|
||||
{
|
||||
Id = i.ToString(),
|
||||
ItemName = $"Item {i}",
|
||||
ImagePrefabPath = imagePath[i % 3],
|
||||
ObjectPrefabPath = prefabPath[i % 3]
|
||||
});
|
||||
}
|
||||
|
||||
prefabGrid?.SetupData(list);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 새로고침 버튼 클릭 시 호출됩니다.
|
||||
/// 리스트의 모든 데이터를 지우고 SetupData를 다시 호출하여 목록을 갱신합니다.
|
||||
/// </summary>
|
||||
public void Refresh()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
/// <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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,2 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 23fd4772d89e5b7418695826ef9cd17e
|
||||
@@ -16,7 +16,7 @@ namespace Assets.Scripts.UVC.Factory.Tab
|
||||
{
|
||||
if (tabController == null)
|
||||
{
|
||||
Debug.LogError("SideTabBar: TabController가 할당되지 않았습니다.");
|
||||
Debug.LogError("TabContentTabComponentList: TabController가 할당되지 않았습니다.");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user