2025-11-06 15:51:29 +09:00
|
|
|
#nullable enable
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
using UVC.UI.List;
|
|
|
|
|
|
|
|
|
|
namespace UVC.UI.Window
|
|
|
|
|
{
|
|
|
|
|
public class LibraryWindow : MonoBehaviour
|
|
|
|
|
{
|
|
|
|
|
[SerializeField]
|
2025-12-08 21:06:05 +09:00
|
|
|
private PrefabGrid prefabGrid = default!;
|
|
|
|
|
|
2025-12-18 20:38:38 +09:00
|
|
|
[Tooltip("드래그 시 그리드 아이템 이미지가 커서를 따라다니도록 설정합니다.")]
|
|
|
|
|
[SerializeField]
|
|
|
|
|
private bool dragImageFollowCursor = true;
|
|
|
|
|
|
2025-12-08 21:06:05 +09:00
|
|
|
/// <summary>
|
|
|
|
|
/// 내부 <see cref="PrefabGrid"/>에 대한 접근자.
|
|
|
|
|
/// 이벤트 구독 등 외부에서 그리드에 직접 접근할 때 사용합니다.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public PrefabGrid PrefabGrid => prefabGrid;
|
2025-11-06 15:51:29 +09:00
|
|
|
|
|
|
|
|
protected void Awake()
|
|
|
|
|
{
|
|
|
|
|
if (prefabGrid == null)
|
|
|
|
|
{
|
|
|
|
|
prefabGrid = GetComponentInChildren<PrefabGrid>();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (prefabGrid == null)
|
|
|
|
|
{
|
2025-12-08 21:06:05 +09:00
|
|
|
Debug.LogError("PrefabGrid component is not assigned or found in Children.");
|
2025-11-06 15:51:29 +09:00
|
|
|
return;
|
|
|
|
|
}
|
2025-12-18 20:38:38 +09:00
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
prefabGrid.dragImageFollowCursor = dragImageFollowCursor;
|
|
|
|
|
}
|
2025-11-06 15:51:29 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public void SetData(List<PrefabGridItemData> list)
|
|
|
|
|
{
|
2025-12-08 21:06:05 +09:00
|
|
|
if (prefabGrid != null)
|
|
|
|
|
{
|
|
|
|
|
prefabGrid.SetupData(list);
|
|
|
|
|
}
|
2025-11-06 15:51:29 +09:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// 닫기
|
|
|
|
|
/// </summary>
|
|
|
|
|
public void Close()
|
|
|
|
|
{
|
|
|
|
|
gameObject.SetActive(false);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|