Exemplo n.º 1
0
        public Facility()
        {
            Name          = "";
            HeaderText    = "";
            Description   = "";
            MainImagePath = "";
            FacilityType  = "";

            baseManufactureCost = new GameEngine.Manufacturing();
        }
Exemplo n.º 2
0
        public static List <DataCards.Facility> getFacilitiesFromXML()
        {
            List <DataCards.Facility> rtnFacilities = new List <DataCards.Facility>();

            //Pulls from the XML
            XmlDocument xmlDoc = new XmlDocument();

            xmlDoc.Load(_DataPath + _FacilitiesXMLPath);

            XmlNodeList xmlTerrainNodes = xmlDoc.GetElementsByTagName("Facility");

            foreach (XmlNode curNode in xmlTerrainNodes)
            {
                DataCards.Facility curFacility = new DataCards.Facility();


                //curFacility.ID = curNode.Attributes["ID"].InnerText;
                curFacility.Name       = curNode.Attributes["Name"].InnerText;
                curFacility.HeaderText = curNode.Attributes["HeaderText"].InnerText;
                curFacility.Type       = curNode.Attributes["Type"].InnerText;


                //////////////////////////////////////////////////
                //Get Manufacturing details. Make this a function when you need it for the next thing like ships..
                //////////////////////////////////////////////////////////////////////////////////////////////////////////
                GameEngine.Manufacturing curManu = new GameEngine.Manufacturing();


                XmlNodeList xmlChildNodes = curNode.ChildNodes;

                foreach (XmlNode curChildNodes in xmlChildNodes)
                {
                    //curWidgetData.addObjImage(new System.Drawing.Bitmap(curImgNode.Attributes["src"].InnerText));


                    if (curChildNodes.Name == "Manufacture")
                    {
                        XmlNodeList xmlChildNodes1 = curChildNodes.ChildNodes;

                        foreach (XmlNode curChildNodes1 in xmlChildNodes1)
                        {
                            if (curChildNodes1.Name == "Resources")
                            {
                                curManu.ResourceCost = Utilities.getIntOrN(curChildNodes1.InnerText, 0);
                            }
                            else if (curChildNodes1.Name == "ConstructionTime")
                            {
                                curManu.BaseConstructionTime = Utilities.getIntOrN(curChildNodes1.InnerText, 1);
                            }
                        }
                    }
                }

                //////////////////////////////////////////////////////////////////////////////////////////////////////////

                curFacility.baseManufactureCost = curManu;

                rtnFacilities.Add(curFacility);
            }


            return(rtnFacilities);
        }
Exemplo n.º 3
0
        public static List<DataCards.Facility> getFacilitiesFromXML()
        {
            List<DataCards.Facility> rtnFacilities = new List<DataCards.Facility>();

            //Pulls from the XML
            XmlDocument xmlDoc = new XmlDocument();
            xmlDoc.Load(_DataPath + _FacilitiesXMLPath);

            XmlNodeList xmlTerrainNodes = xmlDoc.GetElementsByTagName("Facility");

            foreach (XmlNode curNode in xmlTerrainNodes)
            {
                DataCards.Facility curFacility = new DataCards.Facility();

                //curFacility.ID = curNode.Attributes["ID"].InnerText;
                curFacility.Name = curNode.Attributes["Name"].InnerText;
                curFacility.HeaderText = curNode.Attributes["HeaderText"].InnerText;
                curFacility.Type = curNode.Attributes["Type"].InnerText;

                //////////////////////////////////////////////////
                //Get Manufacturing details. Make this a function when you need it for the next thing like ships..
                //////////////////////////////////////////////////////////////////////////////////////////////////////////
                GameEngine.Manufacturing curManu = new GameEngine.Manufacturing();

                XmlNodeList xmlChildNodes = curNode.ChildNodes;

                foreach (XmlNode curChildNodes in xmlChildNodes)
                {
                    //curWidgetData.addObjImage(new System.Drawing.Bitmap(curImgNode.Attributes["src"].InnerText));

                    if (curChildNodes.Name == "Manufacture")
                    {

                        XmlNodeList xmlChildNodes1 = curChildNodes.ChildNodes;

                        foreach (XmlNode curChildNodes1 in xmlChildNodes1)
                        {

                            if (curChildNodes1.Name == "Resources")
                            {
                                curManu.ResourceCost = Utilities.getIntOrN(curChildNodes1.InnerText, 0);
                            }
                            else if (curChildNodes1.Name == "ConstructionTime")
                            {
                                curManu.BaseConstructionTime = Utilities.getIntOrN(curChildNodes1.InnerText, 1);
                            }
                        }
                    }
                }

                //////////////////////////////////////////////////////////////////////////////////////////////////////////

                curFacility.baseManufactureCost = curManu;

                rtnFacilities.Add(curFacility);

            }

            return rtnFacilities;
        }