예제 #1
0
 public bool IsBlocking(Star star)
 {
     return(Unit.IsSkipped(star) && !IsAutoBuild);
 }
예제 #2
0
 public bool Construct(Star star)
 {
     return(false);
 }
예제 #3
0
 public bool IsSkipped(Star star)
 {
     return(true);
 }
예제 #4
0
 public bool Construct(Star star)
 {
     throw new NotImplementedException();
 }
예제 #5
0
 public bool IsSkipped(Star star)
 {
     throw new NotImplementedException();
 }
예제 #6
0
        /// ----------------------------------------------------------------------------
        /// <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
            Design     design     = null;
            ShipDesign shipDesign = null;
            Fleet      fleet      = null;
            Star       star       = 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 "techlevel":
                        TechLevel = int.Parse(xmlnode.FirstChild.Value, System.Globalization.CultureInfo.InvariantCulture);
                        break;

                    // When loading designs we need to know what type of design it is.
                    // To do this we first look ahead at the Type field of the design,
                    // then load a design of the appropriate type (currently Design or ShipDesign).
                    case "design":
                    {
                        string type = xmlnode.FirstChild.SelectSingleNode("Type").FirstChild.Value;
                        if (type.ToLower() == "ship" || type == "starbase")
                        {
                            shipDesign = new ShipDesign(xmlnode);
                            RaceDesigns.Add(shipDesign.Name, shipDesign);
                        }
                        else
                        {
                            design = new Design(xmlnode);
                            RaceDesigns.Add(design.Name, design);
                        }
                    }
                    break;

                    case "shipdesign":
                    {
                        shipDesign = new ShipDesign(xmlnode);
                        RaceDesigns.Add(shipDesign.Name, shipDesign);
                    }
                    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)
                        {
                            string type = deletedDesignsNode.FirstChild.SelectSingleNode("Type").FirstChild.Value;
                            if (type.ToLower() == "ship" || type == "starbase")
                            {
                                shipDesign = new ShipDesign(deletedDesignsNode);
                                DeletedDesigns.Add(shipDesign);
                            }
                            else
                            {
                                design = new Design(deletedDesignsNode);
                                DeletedDesigns.Add(design);
                            }
                            deletedDesignsNode = deletedDesignsNode.NextSibling;
                        }
                        break;

                    case "star":
                        star = new Star(xmlnode);
                        RaceStars.Add(star);
                        break;

                    case "fleet":
                        fleet = new Fleet(xmlnode);
                        RaceFleets.Add(fleet.FleetID, fleet);
                        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)
                        {
                            fleet = new Fleet(deletedFleetsNode);
                            DeletedFleets.Add(fleet);
                            deletedFleetsNode = deletedFleetsNode.NextSibling;
                        }
                        break;

                    case "racedata":
                        PlayerData = new RaceData(xmlnode);
                        break;

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