Files
EnglewoodLAB/Assets/Scripts/Simulator/LNB/SimulatorLNB.cs

66 lines
2.6 KiB
C#

#nullable enable
using UnityEngine;
using UnityEngine.EventSystems;
using UVC.Core;
using UVC.Factory;
using UVC.Factory.Cameras;
using UVC.UI.Tab;
namespace Simulator.LNB
{
public class SimulatorLNB : SingletonScene<SimulatorLNB>, 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", "탐색기", "Simulator/Prefabs/SimulatorLNBExplorer", "Prefabs/UI/Images/icon_side_tab_explorer_128", "탐색기", true);
tabController?.AddTabConfig("Library", "라이브러리", "Simulator/Prefabs/SimulatorLNBLibrary", "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; // 카메라 컨트롤러 활성화
}
}
}