public void ExportNetInfoXML() { Debug.Log("roadimporter xml begin"); TextWriter writer = new StreamWriter(Path.Combine(Path.Combine(DataLocation.addonsPath, "Import"), $"{ExtraUtils.FormatNetworkName() + "_data"}.xml")); Debug.Log(loadedPrefab.GetType()); if (loadedPrefab.m_netAI.GetType() == typeof(RoadAI)) { RoadAssetInfo roadAsset = new RoadAssetInfo(); roadAsset.ReadFromGame(loadedPrefab); XmlSerializer ser = new XmlSerializer(typeof(RoadImporterXML.RoadAssetInfo)); ser.Serialize(writer, roadAsset); } else if (loadedPrefab.m_netAI.GetType() == typeof(TrainTrackAI)) { TrainTrackAssetInfo trainAsset = new TrainTrackAssetInfo(); trainAsset.ReadFromGame(loadedPrefab); XmlSerializer ser = new XmlSerializer(typeof(RoadImporterXML.TrainTrackAssetInfo)); ser.Serialize(writer, trainAsset); } else { throw new NotImplementedException("NetInfo XML Export Error!"); } writer.Close(); Debug.Log("success!!!"); }
public void OnSave() { if (string.IsNullOrEmpty(NameField.text)) { return; } eventsOff_ = true; RoadAssetInfo dto = new RoadAssetInfo(); dto.ReadFromGame(Info); dto.Save(); SavesListBox.Populate(); eventsOff_ = false; OnNameChanged(); }