public static void DeleteData(SimuTestMode mode) { if (File.Exists(configPath + "\\" + mode.TestModeName + ".json")) { File.Delete(configPath + "\\" + mode.TestModeName + ".json"); TestModes.Remove(mode); } else { Debug.Log("Delete fail"); } }
private void SetModeGroup() { for (int i = 0; i < groupMode.transform.childCount; i++) { Destroy(groupMode.transform.GetChild(i).gameObject); } for (int i = 0; i < TestConfig.TestModes.Count; i++) { SimuTestMode mode = TestConfig.TestModes[i]; GameObject ModeObj = Instantiate(objModeToggle, groupMode.transform); ModeObj.GetComponent <ModeButton>().SetModeButton(mode.TestModeName, mode.MapName, mode.LastTime, mode); } }
public void TestConnect(SimuTestMode mode = null) { TestConfig.TestMode = mode; isEnter = mode != null; if (uriRos == null && !Uri.TryCreate(inputField_RosMasterIP.text, UriKind.Absolute, out uriRos)) { text_noticeLocalIP.text = "Address is not legitimate"; text_noticeLocalIP.color = Color.red; return; } thread = new Thread(new ThreadStart(RunConnect)); thread.Start(); }
public static void DeleteData(SimuTestMode mode) { string path = Path.Combine(configPath, mode.TestModeName + ".json"); if (File.Exists(path)) { File.Delete(path); TestModes.Remove(mode); } else { Debug.Log("Delete fail"); } }
public void WriteTestJson(bool isNew = false) { SimuTestMode td = new SimuTestMode(); td.TestModeName = testModeName; td.MapName = TestConfig.testMap.ToString(); td.LastTime = DateTime.Now; td.VoyageTestConfig = VoyageTestManager.Instance.GetVoyageTestConfig(); if (isNew) { td.TestCarStart = new TransformData(new Vec3(-200.0f, 0.0f, -4.5f), new Vec3(0.0f, 90.0f, 0.0f), new Vec3(1f, 1f, 1f)); td.CheckPointSettings = new List <CheckPointSetting> { new CheckPointSetting { Name = "CheckPoint0", transformData = new TransformData(new Vec3(50.0f, -0.5f, 0.0f), new Vec3(0.0f, 0.0f, 0.0f), new Vec3(1f, 1f, 1f)) } }; } else { td.TestCarStart = new TransformData(ObjTestCar.TestCar.transform); foreach (ElementObject item in ElementsManager.Instance.CheckPointList) { var objCheckPoint = item.GetComponent <ObjCheckPoint>(); if (objCheckPoint == null) { continue; } if (td.CheckPointSettings == null) { td.CheckPointSettings = new List <CheckPointSetting>(); } td.CheckPointSettings.Add(objCheckPoint.GetCheckPointSetting()); } foreach (ElementObject item in ElementsManager.Instance.ObstacleList) { var objObstacle = item.GetComponent <ObjObstacle>(); if (objObstacle == null) { continue; } if (td.ObstacleSettings == null) { td.ObstacleSettings = new List <ObstacleSetting>(); } td.ObstacleSettings.Add(objObstacle.ObstacleSetting); } foreach (ElementObject item in ElementsManager.Instance.CarList) { var objCar = item.GetComponent <ObjAICar>(); if (objCar == null) { continue; } if (td.CarAISettings == null) { td.CarAISettings = new List <CarAISetting>(); } td.CarAISettings.Add(objCar.GetCarAISetting()); } foreach (ElementObject item in ElementsManager.Instance.HumanList) { var objhuman = item.GetComponent <ObjHuman>(); if (objhuman == null) { continue; } if (td.HumanSettings == null) { td.HumanSettings = new List <HumanSetting>(); } td.HumanSettings.Add(objhuman.GetHumansetting()); } foreach (ElementObject item in ElementsManager.Instance.TrafficLightList) { var objTL = item.GetComponent <ObjTrafficLight>(); if (objTL == null) { continue; } if (td.TrafficLightSettings == null) { td.TrafficLightSettings = new List <TrafficLightSetting>(); } td.TrafficLightSettings.Add(objTL.TrafficLightSetting); } } string content = JsonConvert.SerializeObject(td); WriteByLineCover(Path.Combine(Application.streamingAssetsPath, "TestConfigs,", td.TestModeName + ".json"), content); if (MainUI.Instance != null) { MainUI.Instance.SetTipText("Mode Save OK"); } TestConfig.TestMode = td; }