#nullable enable using Cysharp.Threading.Tasks; using System.Collections.Generic; using UnityEngine; using UVC.UI.List; using UVC.UI.Tab; namespace Factory.Tab { public class TabContentLibraryGrid : MonoBehaviour, ITabContent { [SerializeField] private PrefabGrid? prefabGrid; protected void Awake() { if (prefabGrid == null) { prefabGrid = GetComponentInChildren(); } if (prefabGrid == null) { Debug.LogError("InfiniteScroll component is not assigned or found in Children."); return; } } public void Start() { SetupData(); } public void SetupData() { List imagePath = new List() { "Simulator/Images/lib_forklift_400x300", "Simulator/Images/lib_pallet_400x300", "Simulator/Images/lib_worker_400x300", }; List prefabPath = new List() { "Prefabs/Forklift", "Prefabs/PalletEmpty", "Prefabs/Male Young Guy", }; List list = new List(); 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); } /// /// 새로고침 버튼 클릭 시 호출됩니다. /// 리스트의 모든 데이터를 지우고 SetupData를 다시 호출하여 목록을 갱신합니다. /// public void Refresh() { } /// /// 탭 콘텐츠에 데이터를 전달합니다. /// /// 전달할 데이터 객체 public void SetContentData(object? data) { Debug.Log("TabContentTabComponentList: SetContentData called"); } /// /// 탭 전환 시 데이터가 있는 경우 전달 되는 데이터. SetContentData 이후 호출 됨 /// /// 전달할 데이터 객체 public void UpdateContentData(object? data) { } /// /// 닫힐 때 실행되는 로직을 처리합니다. /// /// 비동기 닫기 작업을 나타내는 입니다. public UniTask OnCloseAsync() { Debug.Log("TabContentTabComponentList: OnClose called"); return UniTask.CompletedTask; } } }