38 lines
1.3 KiB
C#
38 lines
1.3 KiB
C#
using Simulator.Config;
|
|
using Simulator.Data;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UVC.Data;
|
|
using UVC.Factory;
|
|
using UVC.Network;
|
|
using UVC.UI.Commands;
|
|
using UVC.UI.Modal;
|
|
|
|
public class SimulatorPlayCommand : ICommand
|
|
{
|
|
private object? _parameter;
|
|
public SimulatorPlayCommand(object? parameter = null)
|
|
{
|
|
_parameter = parameter;
|
|
}
|
|
|
|
public async void Execute(object? parameter = null)
|
|
{
|
|
Dictionary<string, object> body = new Dictionary<string, object>()
|
|
{
|
|
{ "projectId",SimulationConfig.projectId },
|
|
{ "logicId",SimulationConfig.logicId },
|
|
{ "logicData",SimulationConfig.logicData },
|
|
{ "name",SimulationConfig.name },
|
|
{ "parameters",SimulationConfig.param }
|
|
};
|
|
var cdata = await HttpRequester.RequestPost<SimulatorCodeDataClass>($"{Constants.HTTP_DOMAIN}/simulation/histories", body, null, true);
|
|
SimulationConfig.SimulationCode = cdata.data.data.simulationCode;
|
|
ComponentsManager.Instance.SubscribeTopic();
|
|
ComponentsManager.Instance.SetMQTT(cdata);
|
|
DataRepository.Instance.MqttReceiver.SetUseWebSocket(true);
|
|
DataRepository.Instance.MqttReceiver.SetUseTLS(true);
|
|
DataRepository.Instance.MqttReceiver.Start();
|
|
}
|
|
}
|