114 lines
3.7 KiB
C#
114 lines
3.7 KiB
C#
using AZTECHWB.Core;
|
|
using AZTECHWB.Management;
|
|
using AZTECHWB.Command;
|
|
using Cysharp.Threading.Tasks;
|
|
using UnityEngine;
|
|
using UVC.UI.Menu;
|
|
using UVC.UI.Toolbar.Model;
|
|
using UVC.UI.ToolBar;
|
|
|
|
namespace AZTECHWB.UI
|
|
{
|
|
public class TopMenuPanel : UIPanel
|
|
{
|
|
[SerializeField]
|
|
private TopMenuController topMenu;
|
|
|
|
[SerializeField]
|
|
private Toolbox topToolBox;
|
|
|
|
public override async UniTask Init()
|
|
{
|
|
topMenu = transform.GetComponentInChildren<TopMenuController>();
|
|
topToolBox = transform.GetComponentInChildren<Toolbox>();
|
|
|
|
SetupTopMenu();
|
|
SetupToolBox();
|
|
await UniTask.CompletedTask;
|
|
}
|
|
|
|
private void SetupTopMenu()
|
|
{
|
|
if (topMenu == null)
|
|
{
|
|
Debug.LogWarning("TopMenuController is not assigned in SceneMain.");
|
|
return;
|
|
}
|
|
topMenu.AddMenuItem(new MenuItemData("production_status", "생산 현황", new OpenProductionProgressPanelCommand()));
|
|
topMenu.AddMenuItem(new MenuItemData("production_alarm", "알림 현황", new OpenAlarmSituationPanelCommand()));
|
|
topMenu.Initialize();
|
|
}
|
|
|
|
private void SetupToolBox()
|
|
{
|
|
var toolbarModel = new ToolbarModel();
|
|
|
|
// --- Top Menu 모델 구성 시작 ---
|
|
|
|
// AI 시뮬레이션
|
|
toolbarModel.AddToggleButton("AI Simulation", false,
|
|
$"UI/Sprites/TopToolBar/IMG_Playback_on",
|
|
$"UI/Sprites/TopToolBar/IMG_Playback",
|
|
(isSelected) =>
|
|
{
|
|
var popupCanvas = AZTECHSceneMain.Instance.GetManager<AZTECHUIManager>().GetCanvas<PopupCanvas>();
|
|
popupCanvas.ResetPanels();
|
|
|
|
var raycaster = AZTECHSceneMain.Instance.GetManager<Raycaster>();
|
|
raycaster.SetInteractable(isSelected);
|
|
|
|
var machineStatusItemManager = AZTECHSceneMain.Instance.GetManager<MachineStatusItemManager>();
|
|
machineStatusItemManager.SetInteractableIcons(!isSelected);
|
|
|
|
if (!isSelected)
|
|
{
|
|
var InfoPanel = AZTECHSceneMain.Instance.GetManager<AZTECHUIManager>().GetCanvas<PopupCanvas>().GetPanel<AISimulationInfoPanel>();
|
|
InfoPanel.Close();
|
|
}
|
|
},
|
|
null
|
|
);
|
|
|
|
// 설정
|
|
toolbarModel.AddToggleButton("Setting", false,
|
|
$"UI/Sprites/TopToolBar/IMG_Setting_on",
|
|
$"UI/Sprites/TopToolBar/IMG_Setting",
|
|
(isSelected) =>
|
|
{
|
|
var uiManager = AZTECHSceneMain.Instance.GetManager<AZTECHUIManager>();
|
|
var settingPanel = uiManager.GetCanvas<PopupCanvas>().GetPanel<SettingPanel>();
|
|
if (isSelected)
|
|
{
|
|
settingPanel.Open();
|
|
}
|
|
else
|
|
{
|
|
settingPanel.Close();
|
|
}
|
|
},
|
|
null
|
|
);
|
|
|
|
//나가기
|
|
toolbarModel.AddStandardButton("Exit",
|
|
$"UI/Sprites/TopToolBar/IMG_Exit",
|
|
new OpenExitProgramPanelCommand()
|
|
);
|
|
|
|
topToolBox.SetData(toolbarModel);
|
|
topToolBox.Initialize();
|
|
}
|
|
|
|
public void InitializeTopMenu()
|
|
{
|
|
SetupTopMenu();
|
|
SetupToolBox();
|
|
}
|
|
public void SetToggleButton(string buttonName, bool isSelected, bool raiseEvent = false)
|
|
{
|
|
topToolBox.SetToggleButtonState(buttonName, isSelected, raiseEvent);
|
|
}
|
|
}
|
|
}
|
|
|