private OrbitalBody(YamlNode node, int _planetID, int _solarSystemID) { orbitalBodyID = _planetID; solarSystemID = _solarSystemID; YamlMappingNode mapping = (YamlMappingNode)node; foreach (var entry in mapping.Children) { string paramName = entry.Key.ToString(); switch (paramName) { case "celestialIndex": celestialIndex = Int32.Parse(entry.Value.ToString()); break; case "asteroidBeltNameID": case "moonNameID": case "planetNameID": orbitalBodyNameID = Int32.Parse(entry.Value.ToString()); break; case "typeID": typeID = Int32.Parse(entry.Value.ToString()); break; case "radius": radius = Double.Parse(entry.Value.ToString()); break; case "position": position = Location.ParseLocation(entry.Value); break; case "planetAttributes": attributes = new OrbitalBodyAttributes(entry.Value); break; case "statistics": statistics = new OrbitalBodyStatistics(entry.Value); break; case "moons": moons = OrbitalBody.LoadYAML(entry.Value, _solarSystemID); break; case "asteroidBelts": asteroidBelts = OrbitalBody.LoadYAML(entry.Value, _solarSystemID); break; case "npcStations": stations = NPCStation.LoadYAML(entry.Value, _solarSystemID); break; default: System.Diagnostics.Debug.WriteLine("OrbitalBody unknown value:" + entry.Key + " = " + entry.Value); break; } } }
public static bool LoadAll(BinaryReader load) { lock (stations) { int count = load.ReadInt32(); for (int i = 0; i < count; i++) { NPCStation station = new NPCStation(load); stations[station.stationID] = station; } } return(true); }
public static List <long> LoadYAML(YamlNode yaml, int _solarSystemID) { if (yaml == null) { return(null); } List <long> stations = new List <long>(); YamlMappingNode mapping = (YamlMappingNode)yaml; foreach (var entry in mapping.Children) { long _stationID = Int64.Parse(entry.Key.ToString()); NPCStation station = new NPCStation(entry.Value, _stationID, _solarSystemID); NPCStation.stations[station.stationID] = station; stations.Add(_stationID); } return(stations); }