<feat> LeftSidePanel, TopMenu 설정
- 사이드바 메뉴 클릭 시 아코디언 펼쳐짐
This commit is contained in:
@@ -3,14 +3,13 @@ using Cysharp.Threading.Tasks;
|
||||
using UVC.UI.Commands;
|
||||
using UVC.UI.Toolbar.Model;
|
||||
using UVC.UI.Toolbar.View;
|
||||
using EnglewoodLAB.UI;
|
||||
using EnglewoodLAB;
|
||||
using UVC.UI.Toolbar;
|
||||
|
||||
namespace EngleWoodLAB.UI
|
||||
namespace EnglewoodLAB.UI
|
||||
{
|
||||
public class BottomLeftToolbar : UIPanel
|
||||
{
|
||||
protected ToolbarView view;
|
||||
internal ToolbarView view;
|
||||
|
||||
public override async UniTask Init()
|
||||
{
|
||||
@@ -25,41 +24,41 @@ namespace EngleWoodLAB.UI
|
||||
{
|
||||
var toolbarModel = new ToolbarModel();
|
||||
//하위 버튼 모델 추가해야함
|
||||
toolbarModel.AddCameraRadioButton("CameraController", "Floor Controller", false,
|
||||
"Prefabs/UI/Toolbar/images/IMG_FloorController_on",
|
||||
"Prefabs/UI/Toolbar/images/IMG_FloorController_off",
|
||||
(isSelected) =>// Debug.Log($"GIS 조절 UI 활성화 상태 : {(isSelected ? "활성화" : "비활성화")} (OnToggle 콜백)")
|
||||
{
|
||||
var floorControl = SceneMain.Instance.uiManager.GetCanvas<PopupCanvas>().GetPanel<FloorControlPanel>();
|
||||
if (!isSelected)
|
||||
{
|
||||
floorControl.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
floorControl.Open();
|
||||
}
|
||||
},
|
||||
new ActionCommand(() => { Debug.Log("층 전환 버튼 클릭"); }),
|
||||
"층 조절 UI를 활성화/비활성화 합니다.");
|
||||
//toolbarModel.AddCameraRadioButton("CameraController", "Floor Controller", false,
|
||||
// "Prefabs/UI/Toolbar/images/IMG_FloorController_on",
|
||||
// "Prefabs/UI/Toolbar/images/IMG_FloorController_off",
|
||||
// (isSelected) =>
|
||||
// {
|
||||
// var floorControl = SceneMain.Instance.uiManager.GetCanvas<PopupCanvas>().GetPanel<FloorControlPanel>();
|
||||
// if (!isSelected)
|
||||
// {
|
||||
// floorControl.Close();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// floorControl.Open();
|
||||
// }
|
||||
// },
|
||||
// new ActionCommand(() => { Debug.Log("설정 버튼 클릭"); }),
|
||||
// "설정 패널을 활성화/비활성화 합니다.");
|
||||
|
||||
toolbarModel.AddCameraRadioButton("CameraController", "Camera Controller", false,
|
||||
"Prefabs/UI/Toolbar/images/IMG_position_on",
|
||||
"Prefabs/UI/Toolbar/images/IMG_position_off",
|
||||
(isSelected) =>// Debug.Log($"GIS 조절 UI 활성화 상태 : {(isSelected ? "활성화" : "비활성화")} (OnToggle 콜백)")
|
||||
{
|
||||
var cameraControl = SceneMain.Instance.uiManager.GetCanvas<PopupCanvas>().GetPanel<CameraControlPanel>();
|
||||
if (!isSelected)
|
||||
{
|
||||
cameraControl.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
cameraControl.Open();
|
||||
}
|
||||
},
|
||||
new ActionCommand(() => { Debug.Log("카메라 위치 전환 패널 활성화/비활성화 버튼 클릭"); }),
|
||||
"카메라 위치 조절 UI를 활성화/비활성화 합니다.");
|
||||
//toolbarModel.AddCameraRadioButton("CameraController", "Camera Controller", false,
|
||||
// "UI/Sprites/ic-tabOpen",
|
||||
// "UI/Sprites/ic-tabClose",
|
||||
// (isSelected) =>
|
||||
// {
|
||||
// var sidePanelControl = SceneMain.Instance.uiManager.GetCanvas<StaticCanvas>().GetPanel<LeftSidePanel>();
|
||||
// if (!isSelected)
|
||||
// {
|
||||
// sidePanelControl.Close();
|
||||
// }
|
||||
// else
|
||||
// {
|
||||
// sidePanelControl.Open();
|
||||
// }
|
||||
// },
|
||||
// new ActionCommand(() => { Debug.Log("사이드패널 토글 버튼 클릭"); }),
|
||||
// "사이드 패널을 열고 닫습니다.");
|
||||
view.Initialize(toolbarModel);
|
||||
}
|
||||
|
||||
|
||||
@@ -12,6 +12,8 @@ namespace EnglewoodLAB.UI
|
||||
[SerializeField]
|
||||
private Toolbar toolbar;
|
||||
[SerializeField]
|
||||
private BottomLeftToolbar bottomLeftToolBar;
|
||||
[SerializeField]
|
||||
private SideTabBar sideTabBar;
|
||||
|
||||
public SideTabBar SideTabBar { get { return sideTabBar; } }
|
||||
@@ -19,50 +21,105 @@ namespace EnglewoodLAB.UI
|
||||
|
||||
public override async UniTask Init()
|
||||
{
|
||||
bool hasError = false;
|
||||
toolbar = transform.GetComponentInChildren<Toolbar>();
|
||||
if (toolbar == null)
|
||||
{
|
||||
Debug.LogError("[LeftSidePanel] Prefab Error: 'Toolbar' component not found in children. Please check the prefab structure.", this.gameObject);
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
bottomLeftToolBar = transform.GetComponentInChildren<BottomLeftToolbar>();
|
||||
if (bottomLeftToolBar == null)
|
||||
{
|
||||
Debug.LogError("[LeftSidePanel] Prefab Error: 'BottomLeftToolbar' component not found in children. Please check the prefab structure.", this.gameObject);
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
sideTabBar = transform.GetComponentInChildren<SideTabBar>();
|
||||
if (sideTabBar == null)
|
||||
{
|
||||
Debug.LogError("[LeftSidePanel] Prefab Error: 'SideTabBar' component not found in children. Please check the prefab structure.", this.gameObject);
|
||||
hasError = true;
|
||||
}
|
||||
|
||||
if (hasError)
|
||||
{
|
||||
// Stop further execution if components are missing
|
||||
return;
|
||||
}
|
||||
|
||||
// Initialize the child component before using it
|
||||
await bottomLeftToolBar.Init();
|
||||
|
||||
SetupToolBox();
|
||||
|
||||
await UniTask.CompletedTask;
|
||||
}
|
||||
private void SetupToolBox()
|
||||
{
|
||||
// ToolbarModel 인스턴스 생성
|
||||
// 1. 탭 정의 및 초기화
|
||||
sideTabBar.InitTab();
|
||||
|
||||
// 2. TabController 가져오기
|
||||
var tabController = sideTabBar.TabController;
|
||||
if(tabController == null)
|
||||
{
|
||||
Debug.LogError("[LeftSidePanel] TabController not found on SideTabBar!", sideTabBar);
|
||||
return;
|
||||
}
|
||||
|
||||
// 3. 상단 툴바 모델 생성 (TabController에서 "Setting" 탭을 제외하고 동적으로 생성)
|
||||
var toolbarModel = new ToolbarModel();
|
||||
var allTabs = tabController.GetAllTabConfigs();
|
||||
|
||||
// --- 툴바 모델 구성 시작 ---
|
||||
foreach (var tabConfig in allTabs)
|
||||
{
|
||||
// "Setting" 탭은 하단 툴바에서 별도로 처리하므로 여기서는 건너뜁니다.
|
||||
if (tabConfig.tabID == "Setting") continue;
|
||||
|
||||
toolbarModel.AddStandardButton(
|
||||
tabConfig.tabName,
|
||||
tabConfig.tabIconPath,
|
||||
new ActivateTabCommand(tabController, tabConfig.tabID),
|
||||
null
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
|
||||
// 내/외벽 활성화/비활성화
|
||||
toolbarModel.AddToggleButton("button_icon_control", false,
|
||||
"Prefabs/UI/Toolbar/images/IMG_WallControl_off",
|
||||
"Prefabs/UI/Toolbar/images/IMG_WallControl_on",
|
||||
(isSelected) =>
|
||||
{
|
||||
var itemManager = SceneMain.Instance.GetManager<MachineInfoItemManager>();
|
||||
itemManager.ActiveIcons(isSelected);
|
||||
|
||||
var themostatManager = SceneMain.Instance.GetManager<ThermostatInfoItemManager>();
|
||||
themostatManager.SetActiveIcon(isSelected);
|
||||
},
|
||||
new ActiveWallControlPanelCommand(),
|
||||
"내/외벽 조절 UI를 활성화/비활성화 합니다.");
|
||||
|
||||
// 라이브러리
|
||||
//toolbarModel.AddToggleButton("button_library", false,
|
||||
// "Prefabs/UI/Toolbar/images/IMG_library_on",
|
||||
// "Prefabs/UI/Toolbar/images/IMG_library_off",
|
||||
// (isSelected) => Debug.Log($"라이브러리 UI 활성화 상태 : {(isSelected ? "활성화" : "비활성화")} (OnToggle 콜백)"),
|
||||
// new LibraryCommand(),
|
||||
// "라이브러리 기능을 켭니다.");
|
||||
|
||||
// --- 툴바 모델 구성 끝 ---
|
||||
|
||||
toolbar.SetData(toolbarModel);
|
||||
toolbar.Initialize();
|
||||
sideTabBar.InitTab();
|
||||
|
||||
// 4. 하단 툴바 모델 생성
|
||||
var bottomLeftToolbarModel = new ToolbarModel();
|
||||
|
||||
// 메뉴 여닫기
|
||||
bottomLeftToolbarModel.AddToggleButton("메뉴 열기", false,
|
||||
"UI/Sprites/ic-tabClose",
|
||||
"UI/Sprites/ic-tabOpen",
|
||||
(isSelected) =>
|
||||
{
|
||||
var tabView = sideTabBar.GetComponentInChildren<UVC.UI.Tab.TabView>();
|
||||
if (tabView != null)
|
||||
{
|
||||
tabView.ToggleMenuSizeAsync(isSelected).Forget();
|
||||
}
|
||||
},
|
||||
null,
|
||||
"사이드 패널을 열고 닫습니다.");
|
||||
|
||||
// 설정 (Tab ID: "Setting")
|
||||
bottomLeftToolbarModel.AddStandardButton("설정",
|
||||
"UI/Sprites/ic-setting",
|
||||
new ActivateTabCommand(tabController, "Setting"),
|
||||
null
|
||||
);
|
||||
|
||||
if (bottomLeftToolBar.view == null)
|
||||
{
|
||||
Debug.LogError("[LeftSidePanel] Prefab Error: The 'view' field on the 'BottomLeftToolbar' component is not assigned. Please assign it in the Unity Inspector.", bottomLeftToolBar);
|
||||
return;
|
||||
}
|
||||
bottomLeftToolBar.view.Initialize(bottomLeftToolbarModel);
|
||||
}
|
||||
|
||||
public void DeactiveSideToolButton()
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace EnglewoodLAB.UI
|
||||
await LoadPanel<LeftSidePanel>();
|
||||
await LoadPanel<TopMenuPanel>();
|
||||
//await LoadPanel<BottomToolbar>();
|
||||
//await LoadPanel<BottomLeftToolbar>();
|
||||
await LoadPanel<BottomLeftToolbar>();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -120,17 +120,17 @@ namespace EnglewoodLAB
|
||||
}
|
||||
private void SetupTopMenu()
|
||||
{
|
||||
if (topMenu == null)
|
||||
{
|
||||
Debug.LogWarning("TopMenuController is not assigned in SceneMain.");
|
||||
return;
|
||||
}
|
||||
topMenu.AddMenuItem(new MenuItemData("total_production_status", "종합 진행 현황", new OpenTotalProgressPanelCommand()));
|
||||
topMenu.AddMenuItem(new MenuItemData("production_status", "작업 진행 현황", new OpenWorkProgressPanelCommand()));
|
||||
topMenu.AddMenuItem(new MenuItemData("production_status", "생산 진행 현황", new OpenProductionProgressPanelCommand()));
|
||||
topMenu.AddMenuItem(new MenuItemData("injection_status", "조립 진행 현황", new OpenAssemblyProgressPanelCommand()));
|
||||
topMenu.AddMenuItem(new MenuItemData("production_status", "최종 검사", new OpenFinalInspectionPanelCommand()));
|
||||
topMenu.Initialize();
|
||||
//if (topMenu == null)
|
||||
//{
|
||||
// Debug.LogWarning("TopMenuController is not assigned in SceneMain.");
|
||||
// return;
|
||||
//}
|
||||
//topMenu.AddMenuItem(new MenuItemData("total_production_status", "종합 진행 현황", new OpenTotalProgressPanelCommand()));
|
||||
//topMenu.AddMenuItem(new MenuItemData("production_status", "작업 진행 현황", new OpenWorkProgressPanelCommand()));
|
||||
//topMenu.AddMenuItem(new MenuItemData("production_status", "생산 진행 현황", new OpenProductionProgressPanelCommand()));
|
||||
//topMenu.AddMenuItem(new MenuItemData("injection_status", "조립 진행 현황", new OpenAssemblyProgressPanelCommand()));
|
||||
//topMenu.AddMenuItem(new MenuItemData("production_status", "최종 검사", new OpenFinalInspectionPanelCommand()));
|
||||
//topMenu.Initialize();
|
||||
}
|
||||
private void SetupToolBox()
|
||||
{
|
||||
@@ -140,20 +140,26 @@ namespace EnglewoodLAB
|
||||
|
||||
// 플레이백
|
||||
toolbarModel.AddStandardButton("플레이백",
|
||||
$"UI/Sprites/TopToolBar/IMG_Playback",
|
||||
$"UI/Sprites/ic-playback",
|
||||
new OpenPlaybackListPanelCommand()
|
||||
);
|
||||
|
||||
// 금일 계획 현황
|
||||
toolbarModel.AddStandardButton("금일 계획 현황",
|
||||
$"UI/Sprites/ic-report",
|
||||
null // TODO: 새로운 함수 만들어야 함.
|
||||
);
|
||||
|
||||
// 알림 목록
|
||||
toolbarModel.AddStandardButton("알림 목록",
|
||||
$"UI/Sprites/TopToolBar/IMG_Alarm",
|
||||
$"UI/Sprites/ic-alarm",
|
||||
new OpenAlarmHistoryPanelCommand(propertyWindow)
|
||||
);
|
||||
|
||||
//설정
|
||||
toolbarModel.AddStandardButton("설정",
|
||||
$"UI/Sprites/TopToolBar/IMG_Setting",
|
||||
new OpenSettingPanelCommand(contentModalView)
|
||||
// 종료
|
||||
toolbarModel.AddStandardButton("종료",
|
||||
$"UI/Sprites/ic-out",
|
||||
null // TODO: 새로운 함수 만들어야 함.
|
||||
);
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user