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; } } }
private SolarSystem(YamlNode node) { YamlNode gateNode = null; YamlNode planetNode = null; YamlNode starNode = null; YamlNode secondarySunNode = null; YamlMappingNode mapping = (YamlMappingNode)node; foreach (var entry in mapping.Children) { string paramName = entry.Key.ToString(); switch (paramName) { case "solarSystemID": solarSystemID = Int32.Parse(entry.Value.ToString()); break; case "solarSystemNameID": solarSystemNameID = Int32.Parse(entry.Value.ToString()); break; case "regional": regional = Boolean.Parse(entry.Value.ToString()); break; case "border": border = Boolean.Parse(entry.Value.ToString()); break; case "corridor": corridor = Boolean.Parse(entry.Value.ToString()); break; case "fringe": fringe = Boolean.Parse(entry.Value.ToString()); break; case "hub": hub = Boolean.Parse(entry.Value.ToString()); break; case "international": international = Boolean.Parse(entry.Value.ToString()); break; case "luminosity": luminosity = Double.Parse(entry.Value.ToString()); break; case "radius": radius = Double.Parse(entry.Value.ToString()); break; case "security": security = Double.Parse(entry.Value.ToString()); break; case "sunTypeID": sunTypeID = Int32.Parse(entry.Value.ToString()); break; case "center": center = Location.ParseLocation(entry.Value); break; case "max": max = Location.ParseLocation(entry.Value); break; case "min": min = Location.ParseLocation(entry.Value); break; case "wormholeClassID": wormholeClassID = Int32.Parse(entry.Value.ToString()); break; case "descriptionID": descriptionID = Int32.Parse(entry.Value.ToString()); break; case "factionID": factionID = Int32.Parse(entry.Value.ToString()); break; case "securityClass": securityClass = entry.Value.ToString(); break; case "disallowedAnchorCategories": disallowedAnchorCategories = new List <int>(); YamlSequenceNode seq = (YamlSequenceNode)entry.Value; foreach (YamlNode seqNode in seq.Children) { disallowedAnchorCategories.Add(Int32.Parse(seqNode.ToString())); } break; case "planets": planetNode = entry.Value; break; case "star": starNode = entry.Value; break; case "stargates": gateNode = entry.Value; break; case "secondarySun": secondarySunNode = entry.Value; break; case "visualEffect": visualEffect = entry.Value.ToString(); break; case "disallowedAnchorGroups": disallowedAnchorGroups = YamlUtils.LoadIntList(entry.Value); break; default: System.Diagnostics.Debug.WriteLine("SolarSystem unknown value:" + entry.Key + " = " + entry.Value); break; } } // Parse these here so we can know we have the solarSystemID. if (gateNode != null) { stargates = Stargate.LoadYAML(gateNode, solarSystemID); } if (planetNode != null) { planets = OrbitalBody.LoadYAML(planetNode, solarSystemID); } if (starNode != null) { star = new Star(starNode, solarSystemID); } if (secondarySunNode != null) { secondarySun = new SecondarySun(secondarySunNode, solarSystemID); } }