Files
AZTECH_WB/Assets/Scripts/Command/ObjectCommand/SelectedMachineCommand.cs

51 lines
1.7 KiB
C#
Raw Normal View History

using AZTECHWB.Core;
using AZTECHWB.Management;
using AZTECHWB.UI;
using UVC.UI.Commands;
namespace AZTECHWB.Command
{
public class SelectedMachineCommand : ICommand
{
private bool isSimulation;
Machine machine;
public SelectedMachineCommand(Machine machine, bool isSimulation)
{
this.machine = machine;
this.isSimulation = isSimulation;
}
public async void Execute(object? parameter = null)
{
if (isSimulation)
{
var aiSimulationManager = AZTECHSceneMain.Instance.GetManager<AISimulationManager>();
var data = await aiSimulationManager.SetSimulationResult(machine);
var popupCanvas = AZTECHSceneMain.Instance.GetManager<AZTECHUIManager>().GetCanvas<PopupCanvas>();
popupCanvas.OpenPanel<AISimulationInfoPanel>(CanvasPanelOpenMode.Single);
var InfoPanel = popupCanvas.GetPanel<AISimulationInfoPanel>();
InfoPanel.SetDataInfo(data);
}
else
{
var controller = AZTECHAppMain.Instance.cameraController;
if (controller.viewMode != ViewMode.PerspectiveView)
{
controller.SetViewMode(ViewMode.PerspectiveView);
}
var centerPos = machine.centerPos;
controller.currentAzimuth = machine.focusAzimuth;
controller.currentElevation = machine.focusElevation;
controller.currentDistance = machine.focusDistance;
controller.SetTargetPos(centerPos);
}
}
}
}