Esempio n. 1
0
 private SolarSystem(BinaryReader load)
 {
     solarSystemID     = load.ReadInt32();
     solarSystemNameID = load.ReadInt32();
     regional          = load.ReadBoolean();
     border            = load.ReadBoolean();
     corridor          = load.ReadBoolean();
     fringe            = load.ReadBoolean();
     hub           = load.ReadBoolean();
     international = load.ReadBoolean();
     luminosity    = load.ReadDouble();
     radius        = load.ReadDouble();
     security      = load.ReadDouble();
     sunTypeID     = load.ReadInt32();
     center        = new Location(load);
     max           = new Location(load);
     min           = new Location(load);
     Loader.Load(out securityClass, load);
     wormholeClassID = load.ReadInt32();
     Loader.Load(out disallowedAnchorCategories, load);
     descriptionID = load.ReadInt32();
     factionID     = load.ReadInt32();
     Loader.Load(out stargates, load);
     Loader.Load(out planets, load);
     star = new Star(load);
     if (load.ReadBoolean())
     {
         secondarySun = new SecondarySun(load);
     }
     else
     {
         secondarySun = null;
     }
     Loader.Load(out visualEffect, load);
     Loader.Load(out disallowedAnchorGroups, load);
 }
Esempio n. 2
0
        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);
            }
        }