|
|
|
|
|
|
using System.IO; |
|
|
|
using System.Threading; |
|
|
|
using System.Threading.Tasks; |
|
|
|
using Newtonsoft.Json; |
|
|
|
using Newtonsoft.Json.Linq; |
|
|
|
using Unity.Simulation.Client; |
|
|
|
using UnityEditor; |
|
|
|
using UnityEditor.Build.Reporting; |
|
|
|
|
|
|
List<AppParam> GenerateAppParamIds(CancellationToken token) |
|
|
|
{ |
|
|
|
var appParamIds = new List<AppParam>(); |
|
|
|
var scenario = (ScenarioBase)m_ScenarioField.value; |
|
|
|
var configuration = JObject.Parse(scenario.Serialize()); |
|
|
|
var constants = configuration["constants"]; |
|
|
|
|
|
|
|
constants["totalIterations"] = m_TotalIterationsField.value; |
|
|
|
constants["instanceCount"]= m_InstanceCountField.value; |
|
|
|
|
|
|
|
var appParamId = API.UploadAppParam(appParamName, new UnitySimulationScenarioConstants |
|
|
|
{ |
|
|
|
totalIterations = m_TotalIterationsField.value, |
|
|
|
instanceCount = m_InstanceCountField.value, |
|
|
|
instanceIndex = i |
|
|
|
}); |
|
|
|
constants["instanceIndex"]= i; |
|
|
|
|
|
|
|
var appParamsString = JsonConvert.SerializeObject(configuration, Formatting.Indented); |
|
|
|
var appParamId = API.UploadAppParam(appParamName, appParamsString); |
|
|
|
appParamIds.Add(new AppParam() |
|
|
|
{ |
|
|
|
id = appParamId, |
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
return appParamIds; |
|
|
|
} |
|
|
|
|
|
|
|