public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Graphics.Color color; XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.factionTechniques.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.factionTechniques.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.factionTechniques.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\FactionTechniques\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(1); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = rectangle; item.Label.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = rectangle; item.Text.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.factionTechniques.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(2); this.factionTechniques.ButtonStartPosition.X = int.Parse(node.Attributes.GetNamedItem("StartX").Value); this.factionTechniques.ButtonStartPosition.Y = int.Parse(node.Attributes.GetNamedItem("StartY").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.factionTechniques.ButtonTextFont = font; this.factionTechniques.ButtonTextColor = color; this.factionTechniques.ButtonTextAlign = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(3); this.factionTechniques.ButtonSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.factionTechniques.ButtonSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.factionTechniques.ButtonBasicTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\FactionTechniques\Data\" + node.Attributes.GetNamedItem("Basic").Value); this.factionTechniques.ButtonAvailableTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\FactionTechniques\Data\" + node.Attributes.GetNamedItem("Available").Value); this.factionTechniques.ButtonUpgradingTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\FactionTechniques\Data\" + node.Attributes.GetNamedItem("Upgrading").Value); this.factionTechniques.ButtonUpgradedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\FactionTechniques\Data\" + node.Attributes.GetNamedItem("Upgraded").Value); node = nextSibling.ChildNodes.Item(4); this.factionTechniques.CommentsClient = StaticMethods.LoadRectangleFromXMLNode(node); this.factionTechniques.CommentsText.ClientWidth = this.factionTechniques.CommentsClient.Width; this.factionTechniques.CommentsText.ClientHeight = this.factionTechniques.CommentsClient.Height; this.factionTechniques.CommentsText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.factionTechniques.CommentsText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.factionTechniques.CommentsText.PositiveColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("PositiveColor").Value); this.factionTechniques.CommentsText.NegativeColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("NegativeColor").Value); this.factionTechniques.CommentsText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.factionTechniques.CommentsText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.factionTechniques.CommentsText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.factionTechniques.CommentsText.DefaultColor = color; }
public void LoadDataFromXMLDocument(string filename) { XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.marshalSectionDialog.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.marshalSectionDialog.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); node = nextSibling.ChildNodes.Item(1); for (int i = 0; i < node.ChildNodes.Count; i += 2) { Font font; Microsoft.Xna.Framework.Graphics.Color color; LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Label.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Text.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.marshalSectionDialog.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(2); this.marshalSectionDialog.OKButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.OKButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.OKButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.marshalSectionDialog.OKButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.OKButtonDisplayTexture = this.marshalSectionDialog.OKButtonDisabledTexture; node = nextSibling.ChildNodes.Item(3); this.marshalSectionDialog.CancelButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.CancelButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.CancelButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.marshalSectionDialog.CancelButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.CancelButtonDisplayTexture = this.marshalSectionDialog.CancelButtonTexture; node = nextSibling.ChildNodes.Item(4); this.marshalSectionDialog.ArchitectureListButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.ArchitectureListButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.ArchitectureListButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.ArchitectureListButtonDisplayTexture = this.marshalSectionDialog.ArchitectureListButtonTexture; node = nextSibling.ChildNodes.Item(5); this.marshalSectionDialog.AIDetailButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.AIDetailButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.AIDetailButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.AIDetailButtonDisplayTexture = this.marshalSectionDialog.AIDetailButtonTexture; node = nextSibling.ChildNodes.Item(6); this.marshalSectionDialog.OrientationButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.OrientationButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.OrientationButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.marshalSectionDialog.OrientationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.OrientationButtonDisplayTexture = this.marshalSectionDialog.OrientationButtonDisabledTexture; }
public void LoadDataFromXMLDocument(string filename) { Font font = null; Microsoft.Xna.Framework.Graphics.Color color; XmlDocument xmlDocument = new XmlDocument(); xmlDocument.Load(filename); XmlNode nextSibling = xmlDocument.FirstChild.NextSibling; XmlNode xmlNodes = nextSibling.ChildNodes.Item(0); this.troopDetail.BackgroundSize.X = int.Parse(xmlNodes.Attributes.GetNamedItem("Width").Value); this.troopDetail.BackgroundSize.Y = int.Parse(xmlNodes.Attributes.GetNamedItem("Height").Value); this.troopDetail.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, string.Concat("GameComponents\\TroopDetail\\Data\\", xmlNodes.Attributes.GetNamedItem("FileName").Value)); xmlNodes = nextSibling.ChildNodes.Item(1); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.TroopNameText = new FreeText(this.graphicsDevice, font, color); this.troopDetail.TroopNameText.Position = rectangle; this.troopDetail.TroopNameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), xmlNodes.Attributes.GetNamedItem("Align").Value); xmlNodes = nextSibling.ChildNodes.Item(2); this.troopDetail.PortraitClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); xmlNodes = nextSibling.ChildNodes.Item(3); int num = 0; while (true) { bool count = num < xmlNodes.ChildNodes.Count; if (!count) { break; } LabelText labelText = new LabelText(); XmlNode xmlNodes1 = xmlNodes.ChildNodes.Item(num); rectangle = StaticMethods.LoadRectangleFromXMLNode(xmlNodes1); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes1, out font, out color); labelText.Label = new FreeText(this.graphicsDevice, font, color); labelText.Label.Position = rectangle; labelText.Label.Align = (TextAlign)Enum.Parse(typeof(TextAlign), xmlNodes1.Attributes.GetNamedItem("Align").Value); labelText.Label.Text = xmlNodes1.Attributes.GetNamedItem("Label").Value; xmlNodes1 = xmlNodes.ChildNodes.Item(num + 1); rectangle = StaticMethods.LoadRectangleFromXMLNode(xmlNodes1); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes1, out font, out color); labelText.Text = new FreeText(this.graphicsDevice, font, color); labelText.Text.Position = rectangle; labelText.Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), xmlNodes1.Attributes.GetNamedItem("Align").Value); labelText.PropertyName = xmlNodes1.Attributes.GetNamedItem("PropertyName").Value; this.troopDetail.LabelTexts.Add(labelText); num = num + 2; } xmlNodes = nextSibling.ChildNodes.Item(4); this.troopDetail.OtherPersonClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.OtherPersonText.ClientWidth = this.troopDetail.OtherPersonClient.Width; this.troopDetail.OtherPersonText.ClientHeight = this.troopDetail.OtherPersonClient.Height; this.troopDetail.OtherPersonText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.OtherPersonText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.OtherPersonText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.OtherPersonText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.troopDetail.OtherPersonText.DefaultColor = color; xmlNodes = nextSibling.ChildNodes.Item(5); this.troopDetail.CombatMethodClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.CombatMethodText.ClientWidth = this.troopDetail.CombatMethodClient.Width; this.troopDetail.CombatMethodText.ClientHeight = this.troopDetail.CombatMethodClient.Height; this.troopDetail.CombatMethodText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.CombatMethodText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.CombatMethodText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); this.troopDetail.CombatMethodText.SubTitleColor2 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor2").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.CombatMethodText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.troopDetail.CombatMethodText.DefaultColor = color; xmlNodes = nextSibling.ChildNodes.Item(6); this.troopDetail.StuntClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.StuntText.ClientWidth = this.troopDetail.CombatMethodClient.Width; this.troopDetail.StuntText.ClientHeight = this.troopDetail.CombatMethodClient.Height; this.troopDetail.StuntText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.StuntText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.StuntText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); this.troopDetail.StuntText.SubTitleColor2 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor2").Value); this.troopDetail.StuntText.SubTitleColor3 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.StuntText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.troopDetail.StuntText.DefaultColor = color; xmlNodes = nextSibling.ChildNodes.Item(7); this.troopDetail.InfluenceClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.InfluenceText.ClientWidth = this.troopDetail.InfluenceClient.Width; this.troopDetail.InfluenceText.ClientHeight = this.troopDetail.InfluenceClient.Height; this.troopDetail.InfluenceText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.InfluenceText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.InfluenceText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); this.troopDetail.InfluenceText.SubTitleColor2 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor2").Value); this.troopDetail.InfluenceText.SubTitleColor3 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.InfluenceText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.troopDetail.InfluenceText.DefaultColor = color; }
public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Graphics.Color color; XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.architectureDetail.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.architectureDetail.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.architectureDetail.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\ArchitectureDetail\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(1); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = rectangle; item.Label.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = rectangle; item.Text.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.architectureDetail.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(2); this.architectureDetail.CharacteristicClient = StaticMethods.LoadRectangleFromXMLNode(node); this.architectureDetail.CharacteristicText.ClientWidth = this.architectureDetail.CharacteristicClient.Width; this.architectureDetail.CharacteristicText.ClientHeight = this.architectureDetail.CharacteristicClient.Height; this.architectureDetail.CharacteristicText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.architectureDetail.CharacteristicText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.architectureDetail.CharacteristicText.DefaultColor = color; node = nextSibling.ChildNodes.Item(3); this.architectureDetail.FacilityClient = StaticMethods.LoadRectangleFromXMLNode(node); this.architectureDetail.FacilityText.ClientWidth = this.architectureDetail.FacilityClient.Width; this.architectureDetail.FacilityText.ClientHeight = this.architectureDetail.FacilityClient.Height; this.architectureDetail.FacilityText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.architectureDetail.FacilityText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.architectureDetail.FacilityText.DefaultColor = color; }
public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Graphics.Color color; XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.createTroop.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.createTroop.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.createTroop.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(1); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.TroopNameText = new FreeText(this.graphicsDevice, font, color); this.createTroop.TroopNameText.Position = rectangle; this.createTroop.TroopNameText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(2); this.createTroop.PortraitClient = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(3); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = rectangle; item.Label.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = rectangle; item.Text.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.createTroop.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(4); this.createTroop.OtherPersonClient = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.OtherPersonText.ClientWidth = this.createTroop.OtherPersonClient.Width; this.createTroop.OtherPersonText.ClientHeight = this.createTroop.OtherPersonClient.Height; this.createTroop.OtherPersonText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.OtherPersonText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.createTroop.OtherPersonText.DefaultColor = color; node = nextSibling.ChildNodes.Item(5); this.createTroop.CombatMethodClient = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.CombatMethodText.ClientWidth = this.createTroop.CombatMethodClient.Width; this.createTroop.CombatMethodText.ClientHeight = this.createTroop.CombatMethodClient.Height; this.createTroop.CombatMethodText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.CombatMethodText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.createTroop.CombatMethodText.DefaultColor = color; node = nextSibling.ChildNodes.Item(6); this.createTroop.StuntClient = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.StuntText.ClientWidth = this.createTroop.StuntClient.Width; this.createTroop.StuntText.ClientHeight = this.createTroop.StuntClient.Height; this.createTroop.StuntText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.StuntText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.createTroop.StuntText.DefaultColor = color; node = nextSibling.ChildNodes.Item(7); this.createTroop.InfluenceClient = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.InfluenceText.ClientWidth = this.createTroop.InfluenceClient.Width; this.createTroop.InfluenceText.ClientHeight = this.createTroop.InfluenceClient.Height; this.createTroop.InfluenceText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.InfluenceText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.createTroop.InfluenceText.DefaultColor = color; node = nextSibling.ChildNodes.Item(8); this.createTroop.MilitaryButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.MilitaryButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.MilitaryButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.MilitaryButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.MilitaryButtonDisplayTexture = this.createTroop.MilitaryButtonTexture; node = nextSibling.ChildNodes.Item(9); this.createTroop.PersonButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.PersonButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.PersonButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.PersonButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.PersonButtonDisplayTexture = this.createTroop.PersonButtonTexture; node = nextSibling.ChildNodes.Item(10); this.createTroop.LeaderButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.LeaderButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.LeaderButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.LeaderButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.LeaderButtonDisplayTexture = this.createTroop.LeaderButtonTexture; node = nextSibling.ChildNodes.Item(11); this.createTroop.RationButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.RationButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.RationButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.RationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.RationButtonDisplayTexture = this.createTroop.RationButtonTexture; node = nextSibling.ChildNodes.Item(12); this.createTroop.CreateButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.CreateButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.CreateButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.CreateButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.CreateButtonDisplayTexture = this.createTroop.CreateButtonTexture; node = nextSibling.ChildNodes.Item(13); this.createTroop.zijinButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.zijinButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.zijinButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.zijinButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.zijinButtonDisplayTexture = this.createTroop.zijinButtonTexture; }
public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Graphics.Color color; XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.transportDialog.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.transportDialog.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); node = nextSibling.ChildNodes.Item(1); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.TitleText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.TitleText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.TitleText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(2); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Label.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Text.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.transportDialog.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(3); this.transportDialog.DestinationButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.DestinationButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.DestinationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.DestinationButtonDisplayTexture = this.transportDialog.DestinationButtonTexture; node = nextSibling.ChildNodes.Item(4); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.DestinationText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.DestinationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.DestinationText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(5); this.transportDialog.InputNumberButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.InputNumberButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.InputNumberButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.InputNumberButtonDisplayTexture = this.transportDialog.InputNumberButtonTexture; node = nextSibling.ChildNodes.Item(6); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.InputNumberText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.InputNumberText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.InputNumberText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(7); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.DestinationCommentText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.DestinationCommentText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.DestinationCommentText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(8); this.transportDialog.StartButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.StartButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.StartButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.transportDialog.StartButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.StartButtonDisplayTexture = this.transportDialog.StartButtonDisabledTexture; node = nextSibling.ChildNodes.Item(9); this.transportDialog.EmperorDestinationButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.EmperorDestinationButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.EmperorDestinationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorDestinationButtonDisplayTexture = this.transportDialog.EmperorDestinationButtonTexture; node = nextSibling.ChildNodes.Item(10); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.EmperorDestinationText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.EmperorDestinationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorDestinationText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(11); this.transportDialog.EmperorInputNumberButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.EmperorInputNumberButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.EmperorInputNumberButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorInputNumberButtonDisplayTexture = this.transportDialog.EmperorInputNumberButtonTexture; node = nextSibling.ChildNodes.Item(12); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.EmperorInputNumberText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.EmperorInputNumberText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorInputNumberText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(13); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.EmperorDestinationCommentText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.EmperorDestinationCommentText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorDestinationCommentText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(14); this.transportDialog.EmperorStartButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.EmperorStartButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.EmperorStartButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.transportDialog.EmperorStartButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorStartButtonDisplayTexture = this.transportDialog.EmperorStartButtonDisabledTexture; node = nextSibling.ChildNodes.Item(15); this.transportDialog.FundDestinationButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.FundDestinationButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.FundDestinationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundDestinationButtonDisplayTexture = this.transportDialog.FundDestinationButtonTexture; node = nextSibling.ChildNodes.Item(16); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.FundDestinationText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.FundDestinationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundDestinationText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(17); this.transportDialog.FundInputNumberButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.FundInputNumberButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.FundInputNumberButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundInputNumberButtonDisplayTexture = this.transportDialog.FundInputNumberButtonTexture; node = nextSibling.ChildNodes.Item(18); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.FundInputNumberText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.FundInputNumberText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundInputNumberText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(19); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.FundDestinationCommentText = new FreeText(this.graphicsDevice, font, color); this.transportDialog.FundDestinationCommentText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundDestinationCommentText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(20); this.transportDialog.FundStartButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.FundStartButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.FundStartButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.transportDialog.FundStartButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundStartButtonDisplayTexture = this.transportDialog.FundStartButtonDisabledTexture; }