133 lines
4.9 KiB
C#
133 lines
4.9 KiB
C#
using AZTECHWB.Command;
|
|
using AZTECHWB.Core;
|
|
using AZTECHWB.Management;
|
|
using AZTECHWB.Wrapper;
|
|
using Cysharp.Threading.Tasks;
|
|
using UnityEngine;
|
|
using UVC.UI.Toolbar;
|
|
using UVC.UI.Toolbar.Model;
|
|
|
|
namespace AZTECHWB.UI
|
|
{
|
|
public class LeftSidePanel : UIPanel
|
|
{
|
|
[SerializeField]
|
|
private Toolbar toolbar;
|
|
|
|
private CaptureRecoder recorder;
|
|
|
|
public override async UniTask Init()
|
|
{
|
|
toolbar = transform.GetComponentInChildren<Toolbar>();
|
|
SetupCaptureSetting();
|
|
SetupToolBox();
|
|
|
|
await UniTask.CompletedTask;
|
|
}
|
|
|
|
private void SetupToolBox()
|
|
{
|
|
// ToolbarModel 인스턴스 생성
|
|
var toolbarModel = new ToolbarModel();
|
|
|
|
// --- 툴바 모델 구성 시작 ---
|
|
|
|
toolbarModel.AddRadioButton("CameraControlGroup", "Top View", false,
|
|
"Prefabs/UI/Toolbar/images/ic_camera_top_on",
|
|
"Prefabs/UI/Toolbar/images/ic_camera_top_off",
|
|
(isSelected) =>
|
|
{
|
|
if (isSelected)
|
|
{
|
|
AZTECHAppMain.Instance.cameraController.SetViewMode(ViewMode.TopView);
|
|
}
|
|
},
|
|
null,
|
|
"Top View 시점으로 변경합니다.");
|
|
toolbarModel.AddRadioButton("CameraControlGroup", "Quarter View", true,
|
|
"Prefabs/UI/Toolbar/images/ic_camera_quarter_on",
|
|
"Prefabs/UI/Toolbar/images/ic_camera_quarter_off",
|
|
(isSelected) =>
|
|
{
|
|
if (isSelected)
|
|
{
|
|
AZTECHAppMain.Instance.cameraController.SetViewMode(ViewMode.PerspectiveView);
|
|
}
|
|
},
|
|
null,
|
|
"Quarter View 시점으로 변경합니다.");
|
|
|
|
toolbarModel.AddToggleButton("button_minimap_screen", false,
|
|
"Prefabs/UI/Toolbar/images/ic_menu_minimap_on",
|
|
"Prefabs/UI/Toolbar/images/ic_menu_minimap_off",
|
|
(isSelected) =>
|
|
{
|
|
var uiManager = AZTECHSceneMain.Instance.GetManager<AZTECHUIManager>();
|
|
var miniMap = uiManager.GetCanvas<PopupCanvas>().GetPanel<MiniMap>();
|
|
|
|
miniMap.SetAcitveMiniMap(isSelected);
|
|
},
|
|
null,
|
|
"미니맵을 활성화/비활성화 합니다.");
|
|
|
|
toolbarModel.AddStandardButton("button_reset_screen",
|
|
"Prefabs/UI/Toolbar/images/ic_menu_refresh",
|
|
new ScreenResetCommand(),
|
|
"화면을 초기화 합니다.");
|
|
|
|
// 화면 캡처
|
|
toolbarModel.AddStandardButton("button_capture_screen",
|
|
"Prefabs/UI/Toolbar/images/ic_menu_capture",
|
|
new ScreenCaptureCommand(),
|
|
"화면을 캡처 합니다.");
|
|
|
|
// 화면 녹화 시작/중지 (ToggleButton)
|
|
toolbarModel.AddToggleButton("button_record_screen", false,
|
|
"Prefabs/UI/Toolbar/images/ic_menu_camera_on",
|
|
"Prefabs/UI/Toolbar/images/ic_menu_camera_off",
|
|
(isSelected) => { recorder.SetRecordStatus(isSelected); },
|
|
null,
|
|
"화면을 녹화합니다.");
|
|
|
|
toolbarModel.AddToggleButton("button_icon_control", false,
|
|
"Prefabs/UI/Toolbar/images/ic_menu_icon_control_off",
|
|
"Prefabs/UI/Toolbar/images/ic_menu_icon_control_on",
|
|
(isSelected) =>
|
|
{
|
|
var itemManager = AZTECHSceneMain.Instance.GetManager<MachineStatusItemManager>();
|
|
itemManager.SetActiveIcons(isSelected);
|
|
},
|
|
null,
|
|
"설비 요약 정보 UI를 활성화/비활성화 합니다.");
|
|
|
|
toolbarModel.AddToggleButton("button_floor_control", true,
|
|
"Prefabs/UI/Toolbar/images/ic_floor_auto_on",
|
|
"Prefabs/UI/Toolbar/images/ic_floor_auto_off",
|
|
(isSelected) =>
|
|
{
|
|
AZTECHSceneMain.Instance.building.SetActiveEmptyFloor(isSelected);
|
|
},
|
|
null,
|
|
"층 자동 전환 기능 및 설비가 있는 층을 제외한 층을 활성화/비활성화 합니다.");
|
|
|
|
// --- 툴바 모델 구성 끝 ---
|
|
toolbar.SetData(toolbarModel);
|
|
toolbar.Initialize();
|
|
}
|
|
private void SetupCaptureSetting()
|
|
{
|
|
recorder = new CaptureRecoder();
|
|
recorder.Setup();
|
|
}
|
|
public void InitializeLeftSidePanel()
|
|
{
|
|
SetupToolBox();
|
|
}
|
|
public void SetToggleButton(string buttonName, bool isSelected, bool raiseEvent = false)
|
|
{
|
|
toolbar.SetToggleButtonState(buttonName, isSelected, raiseEvent);
|
|
}
|
|
}
|
|
}
|
|
|