예제 #1
0
 /// <summary>
 /// Default Constructor.
 /// </summary>
 /// <param name="empire"></param>
 public EmpireIntel(EmpireData empire)
 {
     Id       = empire.Id;
     RaceName = empire.Race.Name;
     Icon     = empire.Race.Icon;
 }
예제 #2
0
파일: Orders.cs 프로젝트: ekolis/stars-nova
        /// <summary>
        /// Read in a set of orders.
        /// </summary>
        /// <param name="xmlnode">An <see cref="XmlNode"/> containing orders.</param>
        public Orders(XmlNode xmlnode)
        {
            // temporary variables for reading in designs, fleets, stars
            ShipDesign design = null;

            // Read the node
            while (xmlnode != null)
            {
                try
                {
                    switch (xmlnode.Name.ToLower())
                    {
                    case "root":
                        xmlnode = xmlnode.FirstChild;
                        continue;

                    case "orders":
                        xmlnode = xmlnode.FirstChild;
                        continue;

                    case "shipdesign":
                        design = new ShipDesign(xmlnode);
                        RaceDesigns.Add(design.Key, design);
                        break;

                    // Deleted designs are in their own section to seperate them from
                    // current designs. We load this section in one loop. The comments
                    // above for designs apply equally to deleted designs.
                    case "deleteddesigns":
                        XmlNode deletedDesignsNode = xmlnode.FirstChild;
                        while (deletedDesignsNode != null)
                        {
                            // only the deletedDesignKey is stored in the xml file
                            long deletedDesignKey = long.Parse(deletedDesignsNode.FirstChild.Value, System.Globalization.NumberStyles.HexNumber);
                            DeletedDesigns.Add(deletedDesignKey);
                            deletedDesignsNode = deletedDesignsNode.NextSibling;
                        }
                        break;

                    // Deleted fleets are contained in their own section to seperate them from
                    // current fleets. We load this section in this loop.
                    case "deletedfleets":
                        XmlNode deletedFleetsNode = xmlnode.FirstChild;
                        while (deletedFleetsNode != null)
                        {
                            // only the fleet.key is stored in the xml file
                            long key = long.Parse(deletedFleetsNode.FirstChild.Value);
                            DeletedFleets.Add(key);
                            deletedFleetsNode = deletedFleetsNode.NextSibling;
                        }
                        break;

                    case "empiredata":
                        EmpireStatus = new EmpireData(xmlnode);
                        break;

                    default: break;
                    }
                }
                catch (Exception e)
                {
                    Report.FatalError(e.Message + "\n Details: \n" + e.ToString());
                }
                xmlnode = xmlnode.NextSibling;
            }
        }