48 lines
1.5 KiB
C#
48 lines
1.5 KiB
C#
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 InfoPanel = AZTECHSceneMain.Instance.GetManager<AZTECHUIManager>().GetCanvas<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);
|
|
}
|
|
}
|
|
}
|
|
} |