Esempio n. 1
0
        public virtual void FromXml(XmlNode node, bool loadButtons)
        {
            this.id          = node.SelectSingleNode("Id").InnerText;
            this.textureArea = StructXml.RectangleFromXml(node.SelectSingleNode("TextureArea"));
            this.picture     = node.SelectSingleNode("Picture").InnerText;
            this.location    = StructXml.PointFromXml(node.SelectSingleNode("Location"));

            this.buttons.Clear();
            if (loadButtons)
            {
                foreach (XmlNode xBtn in node.SelectSingleNode("Buttons"))
                {
                    string typ = xBtn.Name;

                    if (xBtn.Attributes["Template"] != null)
                    {
                        typ = xBtn.Attributes["Template"].Value;
                    }

                    GuiButtonInfo btn = GameEngine.Instance.GuiButtonTemplates[typ].Clone();

                    btn.GuiMenuId = this.id;

                    this.buttons.Add(xBtn.Name, btn);
                }
            }
        }
Esempio n. 2
0
        public void FromXml(XmlNode node)
        {
            //this.GuiMenuId = node.SelectSingleNode("GuiMenuId").InnerText;
            this.Text       = node.SelectSingleNode("Text").InnerText;
            this.Font       = node.SelectSingleNode("Font").InnerText;
            this.ForeColor  = StructXml.ColorFromXml(node.SelectSingleNode("ForeColor").InnerText);
            this.TextFormat = (DrawTextFormat)DrawTextFormat.Parse(typeof(DrawTextFormat), node.SelectSingleNode("TextFormat").InnerText);
            this.ButtonRect = StructXml.RectangleFromXml(node.SelectSingleNode("ButtonRect"));

            this.Tooltip = node.SelectSingleNode("Tooltip").InnerText;

            this.Params.Clear();
            foreach (XmlNode xPar in node.SelectSingleNode("Params").ChildNodes)
            {
                GuiButtonParam par = GuiButtonParam.InvokeCreate(xPar.Attributes["Type"].Value);
                par.FromXml(xPar);
                this.Params.Add(xPar.Name, par);
            }

            this.Picture         = node.SelectSingleNode("Picture").InnerText;
            this.PictureColor    = StructXml.ColorFromXml(node.SelectSingleNode("PictureColor").InnerText);
            this.Enabled         = bool.Parse(node.SelectSingleNode("Enabled").InnerText);
            this.AnimationFrames = int.Parse(node.SelectSingleNode("AnimationFrames").InnerText);
            this.AnimationTime   = int.Parse(node.SelectSingleNode("AnimationTime").InnerText);
        }
Esempio n. 3
0
        public virtual void FromXml(XmlNode node)
        {
            this.title        = node.SelectSingleNode("Title").InnerText;
            this.researched   = bool.Parse(node.SelectSingleNode("Researched").InnerText);
            this.canResearch  = bool.Parse(node.SelectSingleNode("CanResearch").InnerText);
            this.type         = (ItemType)ItemType.Parse(typeof(ItemType), node.SelectSingleNode("ItemType").InnerText);
            this.description  = node.SelectSingleNode("Description").InnerText;
            this.buildTime    = int.Parse(node.SelectSingleNode("BuildTime").InnerText);
            this.buildRank    = int.Parse(node.SelectSingleNode("BuildRank").InnerText);
            this.researchRank = int.Parse(node.SelectSingleNode("ResearchRank").InnerText);
            this.orbitalOnly  = bool.Parse(node.SelectSingleNode("OrbitalOnly").InnerText);
            this.picture      = node.SelectSingleNode("Picture").InnerText;

            XmlNode par;

            this.textureArea = StructXml.RectangleFromXml(node.SelectSingleNode("TextureArea"));

            par = node.SelectSingleNode("Resources");

            this.resources.Clear();
            for (int i = 0; i < par.ChildNodes.Count; i++)
            {
                FactoryResource res = new FactoryResource();
                res.FromXml(par.ChildNodes[i]);

                this.resources.Add(res);
            }

            if (node.SelectSingleNode("Mass") != null)
            {
                this.mass = int.Parse(node.SelectSingleNode("Mass").InnerText);
            }
            if (node.SelectSingleNode("ResearchPointsNeeded") != null)
            {
                this.researchPointsNeeded = int.Parse(node.SelectSingleNode("ResearchPointsNeeded").InnerText);
            }
        }