internal void Draw(SpriteBatch spriteBatch) { if (this.Visible) { Rectangle?nullable; if (this.selected || this.open) { if (this.menuKind.IsLeft) { nullable = null; spriteBatch.Draw(this.Enabled ? this.contextMenu.LeftClickItemSelectedTexture : this.contextMenu.DisabledItemSelectedTexture , this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); if (!this.open) { nullable = null; spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), nullable, this.Enabled ? Color.White : this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } else { nullable = null; spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), nullable, this.Enabled ? Color.Gold : this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } } else { nullable = null; spriteBatch.Draw(this.Enabled ? this.contextMenu.RightClickItemSelectedTexture : this.contextMenu.RightDisabledItemSelectedTexture, this.Position, nullable, this.Enabled ? Color.White : this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); nullable = null; spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), nullable, this.Enabled ? Color.White : this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } if (this.open) { foreach (MenuItem item in this.MenuItems) { item.Draw(spriteBatch); } } else if (this.HasChild) { if (!this.menuKind.ShowLeft) { spriteBatch.Draw(this.contextMenu.HasChildTexture, StaticMethods.CenterRectangle(new Rectangle(this.Position.Right, this.Position.Top, this.contextMenu.HasChildTexture.Width, this.Position.Height), new Rectangle(0, 0, this.contextMenu.HasChildTexture.Width, this.contextMenu.HasChildTexture.Height)), null, this.Enabled ? Color.White : this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); } else { spriteBatch.Draw(this.contextMenu.HasChildTexture, StaticMethods.CenterRectangle(new Rectangle(this.Position.Left, this.Position.Top, -this.contextMenu.HasChildTexture.Width, this.Position.Height), new Rectangle(0, 0, -this.contextMenu.HasChildTexture.Width, -this.contextMenu.HasChildTexture.Height)), null, this.Enabled ? Color.White : this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); } } } else if (this.menuKind.IsLeft) { if (this.Enabled) { nullable = null; spriteBatch.Draw(this.contextMenu.LeftClickItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), null, this.contextMenu.LeftClickTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } else { nullable = null; spriteBatch.Draw(this.contextMenu.DisabledItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), null, this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } } else { if (this.Enabled) { nullable = null; spriteBatch.Draw(this.contextMenu.RightClickItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), null, this.contextMenu.RightClickTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } else { nullable = null; spriteBatch.Draw(this.contextMenu.RightDisabledItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); spriteBatch.Draw(this.TextTexture, StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, this.TextTexture.Width, this.TextTexture.Height)), null, this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.0399f); } } } }
public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Color color; XmlDocument document = new XmlDocument(); string xml = Platform.Current.LoadText(filename); document.LoadXml(xml); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.routewayEditor.BackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.BackgroundSize = new Microsoft.Xna.Framework.Point(int.Parse(node.Attributes.GetNamedItem("Width").Value), int.Parse(node.Attributes.GetNamedItem("Height").Value)); node = nextSibling.ChildNodes.Item(1); this.routewayEditor.CommentBackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.CommentClientWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); node = nextSibling.ChildNodes.Item(2); this.routewayEditor.Comment.ClientWidth = this.routewayEditor.CommentClientWidth; this.routewayEditor.Comment.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.routewayEditor.Comment.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.routewayEditor.Comment.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.routewayEditor.Comment.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.routewayEditor.Comment.Builder = font; //this.routewayEditor.Comment.Builder.SetFreeTextBuilder(font); this.routewayEditor.Comment.DefaultColor = color; node = nextSibling.ChildNodes.Item(3); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.routewayEditor.TitleText = new FreeText(font, color); this.routewayEditor.TitleText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.routewayEditor.TitleText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.routewayEditor.TitleText.Text = node.Attributes["Text"].Value; node = nextSibling.ChildNodes.Item(4); this.routewayEditor.ExtendButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.routewayEditor.ExtendButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.ExtendButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.routewayEditor.ExtendButtonDownTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Down").Value); this.routewayEditor.ExtendButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Disabled").Value); node = nextSibling.ChildNodes.Item(5); this.routewayEditor.CutButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.routewayEditor.CutButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.CutButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.routewayEditor.CutButtonDownTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Down").Value); this.routewayEditor.CutButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Disabled").Value); node = nextSibling.ChildNodes.Item(6); this.routewayEditor.DirectionSwitchPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.routewayEditor.DirectionSwitchTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.DirectionSwitchSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.routewayEditor.DirectionSwitchDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Disabled").Value); node = nextSibling.ChildNodes.Item(7); this.routewayEditor.BuildButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.routewayEditor.BuildButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.BuildButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.routewayEditor.BuildButtonDownTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Down").Value); node = nextSibling.ChildNodes.Item(8); this.routewayEditor.EndButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.routewayEditor.EndButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.EndButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.routewayEditor.EndButtonDownTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Down").Value); node = nextSibling.ChildNodes.Item(9); this.routewayEditor.ExtendMouseArrowSize = new Microsoft.Xna.Framework.Point(int.Parse(node.Attributes.GetNamedItem("Width").Value), int.Parse(node.Attributes.GetNamedItem("Height").Value)); this.routewayEditor.ExtendMouseArrowTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.ExtendDisabledMouseArrowTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Disabled").Value); node = nextSibling.ChildNodes.Item(10); this.routewayEditor.CutMouseArrowSize = new Microsoft.Xna.Framework.Point(int.Parse(node.Attributes.GetNamedItem("Width").Value), int.Parse(node.Attributes.GetNamedItem("Height").Value)); this.routewayEditor.CutMouseArrowTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.CutDisabledMouseArrowTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("Disabled").Value); node = nextSibling.ChildNodes.Item(11); this.routewayEditor.ExtendPointTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.routewayEditor.ExtendPointEndTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\RoutewayEditor\Data\" + node.Attributes.GetNamedItem("End").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); TextAlign align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); for (int i = 0; i < 4; i++) { FreeText item = new FreeText(font, color) { Align = align }; this.routewayEditor.ExtendPointTexts.Add(item); } }
private void screen_OnMouseMove(Microsoft.Xna.Framework.Point position, bool leftDown) { CacheManager.Scale = Scale; bool flag = false; foreach (TechniqueItem item in this.AllTechniques) { if (StaticMethods.PointInRectangle(position, item.Position)) { if (this.current != item) { this.CommentsText.Clear(); this.CommentsText.AddText(item.LinkedTechnique.Name, this.CommentsText.TitleColor); this.CommentsText.AddNewLine(); this.CommentsText.AddText(item.LinkedTechnique.Description, this.CommentsText.DefaultColor); this.CommentsText.AddNewLine(); if (this.Control) { this.CommentsText.AddNewLine(); if (this.ShowingFaction.IsTechniqueUpgrading(item.LinkedTechnique.ID)) { this.CommentsText.AddText("正在升级中……剩余", this.CommentsText.SubTitleColor); this.CommentsText.AddText((this.ShowingFaction.UpgradingDaysLeft * Session.Parameters.DayInTurn).ToString(), Microsoft.Xna.Framework.Color.Lime); this.CommentsText.AddText("天", this.CommentsText.SubTitleColor); } else if (this.ShowingFaction.HasTechnique(item.LinkedTechnique.ID)) { this.CommentsText.AddText("已拥有", this.CommentsText.SubTitleColor2); } else if (this.ShowingFaction.MatchTechnique(item.LinkedTechnique, this.UpgradingArchitecture)) { this.CommentsText.AddText("可升级", this.CommentsText.PositiveColor); this.CommentsText.AddNewLine(); this.CommentsText.AddText("升级时间", this.CommentsText.DefaultColor); this.CommentsText.AddText(this.ShowingFaction == null ? item.LinkedTechnique.Days.ToString() : this.ShowingFaction.getTechniqueActualTime(item.LinkedTechnique).ToString(), this.CommentsText.PositiveColor); this.CommentsText.AddText("回合", this.CommentsText.DefaultColor); this.CommentsText.AddNewLine(); this.CommentsText.AddText("势力声望:" + (this.ShowingFaction == null ? item.LinkedTechnique.Reputation.ToString() : this.ShowingFaction.getTechniqueActualReputation(item.LinkedTechnique).ToString()) + ",技巧点数:" + (this.ShowingFaction == null ? item.LinkedTechnique.PointCost.ToString() : this.ShowingFaction.getTechniqueActualPointCost(item.LinkedTechnique).ToString()) + ",资金:" + (this.ShowingFaction == null ? item.LinkedTechnique.FundCost.ToString() : this.ShowingFaction.getTechniqueActualFundCost(item.LinkedTechnique).ToString()), this.CommentsText.DefaultColor); if (item.LinkedTechnique.PreID >= 0) { this.CommentsText.AddText(",前提条件:" + Session.Current.Scenario.GameCommonData.AllTechniques.GetTechnique(item.LinkedTechnique.PreID).Name, this.CommentsText.DefaultColor); } this.CommentsText.AddNewLine(); this.CommentsText.AddText("请单击鼠标左键开始升级", this.CommentsText.SubTitleColor2); } else { this.CommentsText.AddText("升级时间", this.CommentsText.DefaultColor); this.CommentsText.AddText(this.ShowingFaction == null ? item.LinkedTechnique.Days.ToString() : this.ShowingFaction.getTechniqueActualTime(item.LinkedTechnique).ToString(), this.CommentsText.PositiveColor); this.CommentsText.AddText("回合", this.CommentsText.DefaultColor); this.CommentsText.AddNewLine(); this.CommentsText.AddNewLine(); this.CommentsText.AddText("未达到升级条件:", this.CommentsText.SubTitleColor); this.CommentsText.AddNewLine(); if (this.ShowingFaction.Reputation >= (this.ShowingFaction == null ? item.LinkedTechnique.Reputation : this.ShowingFaction.getTechniqueActualReputation(item.LinkedTechnique))) { this.CommentsText.AddText("势力声望:" + (this.ShowingFaction == null ? item.LinkedTechnique.Reputation.ToString() : this.ShowingFaction.getTechniqueActualReputation(item.LinkedTechnique).ToString()), this.CommentsText.PositiveColor); } else { this.CommentsText.AddText("势力声望:" + (this.ShowingFaction == null ? item.LinkedTechnique.Reputation.ToString() : this.ShowingFaction.getTechniqueActualReputation(item.LinkedTechnique).ToString()), this.CommentsText.NegativeColor); } this.CommentsText.AddNewLine(); if (this.ShowingFaction.TotalTechniquePoint >= (this.ShowingFaction == null ? item.LinkedTechnique.PointCost : this.ShowingFaction.getTechniqueActualPointCost(item.LinkedTechnique))) { this.CommentsText.AddText("技巧点数:" + (this.ShowingFaction == null ? item.LinkedTechnique.PointCost.ToString() : this.ShowingFaction.getTechniqueActualPointCost(item.LinkedTechnique).ToString()), this.CommentsText.PositiveColor); } else { this.CommentsText.AddText("技巧点数:" + (this.ShowingFaction == null ? item.LinkedTechnique.PointCost.ToString() : this.ShowingFaction.getTechniqueActualPointCost(item.LinkedTechnique).ToString()), this.CommentsText.NegativeColor); } this.CommentsText.AddNewLine(); if (this.UpgradingArchitecture.Fund >= (this.ShowingFaction == null ? item.LinkedTechnique.FundCost : this.ShowingFaction.getTechniqueActualFundCost(item.LinkedTechnique))) { this.CommentsText.AddText("资金:" + (this.ShowingFaction == null ? item.LinkedTechnique.FundCost.ToString() : this.ShowingFaction.getTechniqueActualFundCost(item.LinkedTechnique).ToString()), this.CommentsText.PositiveColor); } else { this.CommentsText.AddText("资金:" + (this.ShowingFaction == null ? item.LinkedTechnique.FundCost.ToString() : this.ShowingFaction.getTechniqueActualFundCost(item.LinkedTechnique).ToString()), this.CommentsText.NegativeColor); } if (item.LinkedTechnique.PreID >= 0) { this.CommentsText.AddNewLine(); if (this.ShowingFaction.HasTechnique(item.LinkedTechnique.PreID)) { this.CommentsText.AddText("前提条件:" + Session.Current.Scenario.GameCommonData.AllTechniques.GetTechnique(item.LinkedTechnique.PreID).Name, this.CommentsText.PositiveColor); } else { this.CommentsText.AddText("前提条件:" + Session.Current.Scenario.GameCommonData.AllTechniques.GetTechnique(item.LinkedTechnique.PreID).Name, this.CommentsText.NegativeColor); } } if (item.LinkedTechnique.Conditions.Count > 0) { foreach (Condition c in item.LinkedTechnique.Conditions.Conditions.Values) { this.CommentsText.AddNewLine(); if (c.CheckCondition(this.ShowingFaction)) { this.CommentsText.AddText("条件:" + c.Name, this.CommentsText.PositiveColor); } else { this.CommentsText.AddText("条件:" + c.Name, this.CommentsText.NegativeColor); } } } if (this.ShowingFaction.UpgradingTechnique >= 0) { this.CommentsText.AddNewLine(); this.CommentsText.AddText("已经有技巧正在升级中", this.CommentsText.NegativeColor); } } this.CommentsText.AddNewLine(); } this.CommentsText.ResortTexts(); this.current = item; } flag = true; } } if (!flag) { this.current = null; this.CommentsText.Clear(); } CacheManager.Scale = Vector2.One; }
internal void SetPosition(ShowPosition showPosition) { Rectangle rectDes = new Rectangle(0, 0, this.screen.viewportSize.X, this.screen.viewportSize.Y); Rectangle rect = new Rectangle(0, 0, this.BackgroundSize.X, this.BackgroundSize.Y); switch (showPosition) { case ShowPosition.Center: rect = StaticMethods.GetCenterRectangle(rectDes, rect); break; case ShowPosition.Top: rect = StaticMethods.GetTopRectangle(rectDes, rect); break; case ShowPosition.Left: rect = StaticMethods.GetLeftRectangle(rectDes, rect); break; case ShowPosition.Right: rect = StaticMethods.GetRightRectangle(rectDes, rect); break; case ShowPosition.Bottom: rect = StaticMethods.GetBottomRectangle(rectDes, rect); break; case ShowPosition.TopLeft: rect = StaticMethods.GetTopLeftRectangle(rectDes, rect); break; case ShowPosition.TopRight: rect = StaticMethods.GetTopRightRectangle(rectDes, rect); break; case ShowPosition.BottomLeft: rect = StaticMethods.GetBottomLeftRectangle(rectDes, rect); break; case ShowPosition.BottomRight: rect = StaticMethods.GetBottomRightRectangle(rectDes, rect); break; } this.DisplayOffset = new Point(rect.X, rect.Y); this.SurNameText.DisplayOffset = this.DisplayOffset; this.GivenNameText.DisplayOffset = this.DisplayOffset; this.CalledNameText.DisplayOffset = this.DisplayOffset; foreach (LabelText text in this.LabelTexts) { text.Label.DisplayOffset = this.DisplayOffset; text.Text.DisplayOffset = this.DisplayOffset; } this.TitleText.DisplayOffset = new Point(this.DisplayOffset.X + this.TitleClient.X, this.DisplayOffset.Y + this.TitleClient.Y); // this.GuanzhiText.DisplayOffset = new Point(this.DisplayOffset.X + this.GuanzhiClient.X, this.DisplayOffset.Y + this.GuanzhiClient.Y); this.AllSkillTexts.DisplayOffset = this.DisplayOffset; this.PersonSkillTexts.DisplayOffset = this.DisplayOffset; this.LearnableSkillTexts.DisplayOffset = this.DisplayOffset; this.StuntText.DisplayOffset = new Point(this.DisplayOffset.X + this.StuntClient.X, this.DisplayOffset.Y + this.StuntClient.Y); this.InfluenceText.DisplayOffset = new Point(this.DisplayOffset.X + this.InfluenceClient.X, this.DisplayOffset.Y + this.InfluenceClient.Y); this.ConditionText.DisplayOffset = new Point(this.DisplayOffset.X + this.ConditionClient.X, this.DisplayOffset.Y + this.ConditionClient.Y); this.BiographyText.DisplayOffset = new Point(this.DisplayOffset.X + this.BiographyClient.X, this.DisplayOffset.Y + this.BiographyClient.Y); }
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; }
private void screen_OnMouseMove(Point position, bool leftDown) { if (this.screen.PeekUndoneWork().Kind == UndoneWorkKind.Dialog) { if (StaticMethods.PointInRectangle(position, this.MilitaryButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonSelectedTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonTexture; } } else if (StaticMethods.PointInRectangle(position, this.PersonButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonSelectedTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonTexture; } } else if (StaticMethods.PointInRectangle(position, this.LeaderButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonSelectedTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonTexture; } } else if (StaticMethods.PointInRectangle(position, this.RationButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonSelectedTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonTexture; } } else if (StaticMethods.PointInRectangle(position, this.CreateButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonSelectedTexture; } } else if (StaticMethods.PointInRectangle(position, this.zijinButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonSelectedTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonTexture; } } else { if (this.MilitaryButtonEnabled) { this.MilitaryButtonDisplayTexture = this.MilitaryButtonTexture; } if (this.PersonButtonEnabled) { this.PersonButtonDisplayTexture = this.PersonButtonTexture; } if (this.LeaderButtonEnabled) { this.LeaderButtonDisplayTexture = this.LeaderButtonTexture; } if (this.RationButtonEnabled) { this.RationButtonDisplayTexture = this.RationButtonTexture; } if (this.zijinButtonEnabled) { this.zijinButtonDisplayTexture = this.zijinButtonTexture; } if (this.CreateButtonEnabled) { this.CreateButtonDisplayTexture = this.CreateButtonTexture; } } } }
private void screen_OnMouseMove(Point position, bool leftDown) { bool flag = false; if (!flag && StaticMethods.PointInRectangle(position, this.TitleDisplayPosition) && this.TitleText.RowHeight > 0) { int num2 = (position.Y - this.TitleText.DisplayOffset.Y) / this.TitleText.RowHeight; if (num2 >= 0) { int num3 = num2; if (this.ShowingPerson.Titles.Count > num3) { Title title = this.ShowingPerson.Titles[num3] as Title; if (title != null) { if (this.current != title) { this.BiographyText.Clear(); this.InfluenceText.Clear(); //阿柒:增加根据称号等级设定不同字体颜色 Color titleColor = Color.White; if (title.Level < 4) { titleColor = Color.AliceBlue; } else if (title.Level >= 4 && title.Level < 7) { titleColor = Color.YellowGreen; } else if (title.Level >= 7 && title.Level < 10) { titleColor = Color.LightSkyBlue; } else if (title.Level >= 10 && title.Level < 13) { titleColor = Color.Violet; } else { titleColor = Color.Orange; } this.InfluenceText.AddText(title.DetailedName, titleColor); this.InfluenceText.AddNewLine(); foreach (Influence influence in title.Influences.Influences.Values) { //阿柒:根据影响种类设定不同颜色 if (influence.Kind.ID == 280 || influence.Kind.ID == 281 || influence.Kind.ID == 285 || influence.Kind.ID == 290 || influence.Kind.ID == 300) { this.InfluenceText.AddText(influence.Description, Color.Moccasin); } else { this.InfluenceText.AddText(influence.Description); } this.InfluenceText.AddNewLine(); } this.InfluenceText.ResortTexts(); this.ConditionText.Clear(); this.ConditionText.AddText("修习条件", this.ConditionText.TitleColor); this.ConditionText.AddNewLine(); foreach (Condition condition in title.Conditions.Conditions.Values) { if (condition.CheckCondition(this.ShowingPerson)) { this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); } else { this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); } this.ConditionText.AddNewLine(); } foreach (Condition condition in title.ArchitectureConditions.Conditions.Values) { if (this.ShowingPerson.LocationArchitecture != null && condition.CheckCondition(this.ShowingPerson.LocationArchitecture)) { this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); } else { this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); } this.ConditionText.AddNewLine(); } foreach (Condition condition in title.FactionConditions.Conditions.Values) { if (this.ShowingPerson.BelongedFaction != null && condition.CheckCondition(this.ShowingPerson.BelongedFaction)) { this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); } else { this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); } this.ConditionText.AddNewLine(); } this.ConditionText.ResortTexts(); this.current = title; } flag = true; } } } } /* if (!flag && StaticMethods.PointInRectangle(position, this.GuanzhiDisplayPosition)) * { * int num2 = (position.Y - this.GuanzhiText.DisplayOffset.Y / this.GuanzhiText.RowHeight); * if (num2 > 1) * { * int num3 = num2 - 2; * if (this.ShowingPerson.Guanzhis.Count > num3) * { * Guanzhi guanzhi = this.ShowingPerson.Guanzhis[num3] as Guanzhi; * if (guanzhi != null) * { * if (this.current != guanzhi) * { * this.BiographyText.Clear(); * this.InfluenceText.Clear(); * this.InfluenceText.AddText(guanzhi.DetailedName, this.InfluenceText.TitleColor); * this.InfluenceText.AddNewLine(); * foreach (Influence influence in guanzhi.Influences.Influences.Values) * { * this.InfluenceText.AddText(influence.Description); * this.InfluenceText.AddNewLine(); * } * this.InfluenceText.ResortTexts(); * this.ConditionText.Clear(); * this.ConditionText.AddText("授予条件", this.ConditionText.TitleColor); * this.ConditionText.AddNewLine(); * foreach (Condition condition in guanzhi.Conditions.Conditions.Values) * { * if (condition.CheckCondition(this.ShowingPerson)) * { * this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); * } * else * { * this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); * } * this.ConditionText.AddNewLine(); * } * foreach (Condition condition in guanzhi.LoseConditions.Conditions.Values) * { * if (condition.CheckCondition(this.ShowingPerson)) * { * this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); * } * else * { * this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); * } * this.ConditionText.AddNewLine(); * } * foreach (Condition condition in guanzhi.FactionConditions.Conditions.Values) * { * if (this.ShowingPerson.BelongedFaction != null && condition.CheckCondition(this.ShowingPerson.BelongedFaction)) * { * this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); * } * else * { * this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); * } * this.ConditionText.AddNewLine(); * } * * this.ConditionText.ResortTexts(); * this.current = guanzhi; * } * flag = true; * } * } * } * }*/ if (!flag && StaticMethods.PointInRectangle(position, this.StuntDisplayPosition) && this.StuntText.RowHeight > 0) { int num2 = (position.Y - this.StuntText.DisplayOffset.Y) / this.StuntText.RowHeight; if (num2 > -1) { int num3 = num2; if (this.ShowingPerson.Stunts.Count > num3) { Stunt stunt = this.ShowingPerson.Stunts.GetStuntList()[num3] as Stunt; if (stunt != null) { if (this.current != stunt) { this.BiographyText.Clear(); this.InfluenceText.Clear(); this.InfluenceText.AddText("战斗特技", this.InfluenceText.TitleColor); this.InfluenceText.AddText(stunt.Name, this.InfluenceText.SubTitleColor); this.InfluenceText.AddNewLine(); this.InfluenceText.AddText("持续天数", this.InfluenceText.SubTitleColor2); this.InfluenceText.AddText(stunt.Period.ToString(), this.InfluenceText.SubTitleColor3); this.InfluenceText.AddText("天", this.InfluenceText.SubTitleColor2); this.InfluenceText.AddNewLine(); foreach (Influence influence in stunt.Influences.Influences.Values) { this.InfluenceText.AddText(influence.Description); this.InfluenceText.AddNewLine(); } this.InfluenceText.ResortTexts(); this.ConditionText.Clear(); this.ConditionText.AddText("使用条件", this.ConditionText.TitleColor); this.ConditionText.AddNewLine(); if ((this.ShowingPerson.LocationTroop != null) && (this.ShowingPerson == this.ShowingPerson.LocationTroop.Leader)) { foreach (Condition condition in stunt.CastConditions.Conditions.Values) { if (condition.CheckCondition(this.ShowingPerson.LocationTroop)) { this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); } else { this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); } this.ConditionText.AddNewLine(); } } else { foreach (Condition condition in stunt.CastConditions.Conditions.Values) { this.ConditionText.AddText(condition.Name); this.ConditionText.AddNewLine(); } } this.ConditionText.AddNewLine(); this.ConditionText.AddText("修习条件", this.ConditionText.SubTitleColor); this.ConditionText.AddNewLine(); foreach (Condition condition in stunt.LearnConditions.Conditions.Values) { if (condition.CheckCondition(this.ShowingPerson)) { this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); } else { this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); } this.ConditionText.AddNewLine(); } this.ConditionText.ResortTexts(); this.current = stunt; } flag = true; } } } } if (!flag) { for (int i = 0; i < this.AllSkillTexts.Count; i++) { if (StaticMethods.PointInRectangle(position, this.AllSkillTexts[i].AlignedPosition)) { if (this.current != this.LinkedSkills[i]) { this.BiographyText.Clear(); this.InfluenceText.Clear(); if (this.LinkedSkills[i].InfluenceCount > 0) { this.InfluenceText.AddText("技能", this.InfluenceText.TitleColor); this.InfluenceText.AddText(this.LinkedSkills[i].Name, this.InfluenceText.SubTitleColor); this.InfluenceText.AddNewLine(); foreach (Influence influence in this.LinkedSkills[i].Influences.Influences.Values) { //阿柒:根据影响种类设定不同颜色 if (influence.Kind.ID == 280 || influence.Kind.ID == 281 || influence.Kind.ID == 285 || influence.Kind.ID == 290 || influence.Kind.ID == 300) { this.InfluenceText.AddText(influence.Description, Color.Moccasin); } else { this.InfluenceText.AddText(influence.Description); } this.InfluenceText.AddNewLine(); } this.InfluenceText.ResortTexts(); this.ConditionText.Clear(); this.ConditionText.AddText("修习条件", this.ConditionText.TitleColor); this.ConditionText.AddNewLine(); foreach (Condition condition in this.LinkedSkills[i].Conditions.Conditions.Values) { if (condition.CheckCondition(this.ShowingPerson)) { this.ConditionText.AddText(condition.Name, this.ConditionText.PositiveColor); } else { this.ConditionText.AddText(condition.Name, this.ConditionText.NegativeColor); } this.ConditionText.AddNewLine(); } this.ConditionText.ResortTexts(); } this.current = this.LinkedSkills[i]; } flag = true; break; } } } if (!flag) { if (this.current != null) { this.current = null; this.InfluenceText.Clear(); this.ConditionText.Clear(); if (this.ShowingPerson.PersonBiography != null) { this.BiographyText.Clear(); this.BiographyText.AddText("列传", this.BiographyText.TitleColor); this.BiographyText.AddNewLine(); this.BiographyText.AddText(this.ShowingPerson.PersonBiography.Brief); this.BiographyText.AddNewLine(); this.BiographyText.AddText("演义", this.BiographyText.SubTitleColor); this.BiographyText.AddNewLine(); this.BiographyText.AddText(this.ShowingPerson.PersonBiography.Romance); this.BiographyText.AddNewLine(); this.BiographyText.AddText("历史", this.BiographyText.SubTitleColor2); this.BiographyText.AddNewLine(); this.BiographyText.AddText(this.ShowingPerson.PersonBiography.History); this.BiographyText.AddNewLine(); this.BiographyText.AddText("剧本", this.BiographyText.SubTitleColor2); this.BiographyText.AddText(":"); String[] lineBrokenText = ShowingPerson.PersonBiography.InGame.Split('\n'); foreach (String s in lineBrokenText) { this.BiographyText.AddText(s); this.BiographyText.AddNewLine(); } this.BiographyText.ResortTexts(); } } } }
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); 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); 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); 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); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.InfluenceText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.troopDetail.InfluenceText.DefaultColor = color; }
private void screen_OnMouseLeftDown(Point position) { bool currentPageIndex = !StaticMethods.PointInRectangle(position, this.OtherPersonDisplayPosition); if (currentPageIndex) { currentPageIndex = !StaticMethods.PointInRectangle(position, this.CombatMethodDisplayPosition); if (currentPageIndex) { currentPageIndex = !StaticMethods.PointInRectangle(position, this.StuntDisplayPosition); if (currentPageIndex) { currentPageIndex = !StaticMethods.PointInRectangle(position, this.InfluenceDisplayPosition); if (!currentPageIndex) { currentPageIndex = this.InfluenceText.CurrentPageIndex >= this.InfluenceText.PageCount - 1; if (currentPageIndex) { currentPageIndex = this.InfluenceText.CurrentPageIndex != this.InfluenceText.PageCount - 1; if (!currentPageIndex) { this.InfluenceText.FirstPage(); } } else { this.InfluenceText.NextPage(); } } } else { currentPageIndex = this.StuntText.CurrentPageIndex >= this.StuntText.PageCount - 1; if (currentPageIndex) { currentPageIndex = this.StuntText.CurrentPageIndex != this.StuntText.PageCount - 1; if (!currentPageIndex) { this.StuntText.FirstPage(); } } else { this.StuntText.NextPage(); } } } else { currentPageIndex = this.CombatMethodText.CurrentPageIndex >= this.CombatMethodText.PageCount - 1; if (currentPageIndex) { currentPageIndex = this.CombatMethodText.CurrentPageIndex != this.CombatMethodText.PageCount - 1; if (!currentPageIndex) { this.CombatMethodText.FirstPage(); } } else { this.CombatMethodText.NextPage(); } } } else { currentPageIndex = this.OtherPersonText.CurrentPageIndex >= this.OtherPersonText.PageCount - 1; if (currentPageIndex) { currentPageIndex = this.OtherPersonText.CurrentPageIndex != this.OtherPersonText.PageCount - 1; if (!currentPageIndex) { this.OtherPersonText.FirstPage(); } } else { this.OtherPersonText.NextPage(); } } }
private void LogToEverything(IUntypedActorContext context, string message) { _mediator.Tell(new Publish(Topics.Status, new SignalRMessage($"{DateTime.Now}: {StaticMethods.GetSystemUniqueName()}", "Identity", message)), context.Self); _logger.Info(message); }
public bool HasRealStatic(IEmitter emitter) { var result = ClassType == ClassType.Struct || StaticConfig.HasMembers || StaticProperties.Count > 0 || StaticCtor != null || Operators.Count > 0; if (result) { return(true); } if (StaticMethods.Any(group => { foreach (var method in group.Value) { if (Helpers.IsEntryPointMethod(emitter, method)) { return(false); } if (method.Attributes.Count == 0) { return(true); } foreach (var attrSection in method.Attributes) { foreach (var attr in attrSection.Attributes) { var rr = emitter.Resolver.ResolveNode(attr.Type); if (rr.Type.FullName == "H5.InitAttribute") { if (!attr.HasArgumentList) { return(true); } var expr = attr.Arguments.First(); var argrr = emitter.Resolver.ResolveNode(expr); if (argrr.ConstantValue is int) { var value = (InitPosition)argrr.ConstantValue; if (value == InitPosition.Before || value == InitPosition.Top) { return(false); } } return(true); } else { return(true); } } } } return(false); })) { return(true); } if (Type.GetConstructors().Any(c => c.Parameters.Count == 0 && emitter.GetInline(c) != null)) { return(true); } return(false); }
//private void HandleLaterMouseEventOld(GameTime gameTime) //{ // if (base.EnableMouseEvent && base.EnableLaterMouseEvent) // { // if (!StaticMethods.PointInViewport(new Point(InputManager.NowMouse.X, InputManager.NowMouse.Y), base.viewportSize)) // { // this.UpdateViewMove(); // } // else // { // this.ResetCurrentStatus(); // this.CurrentArchitecture = Session.Current.Scenario.GetArchitectureByPosition(this.position); // this.CurrentTroop = Session.Current.Scenario.GetTroopByPosition(this.position); // this.CurrentRouteway = Session.Current.Scenario.GetRoutewayByPositionAndFaction(this.position, Session.Current.Scenario.CurrentPlayer); // this.HandleLaterMouseMove(); // this.HandleLaterMouseScroll(); // if (this.viewMove == ViewMove.Stop) // { // this.HandleLaterMouseLeftDown(); // this.HandleLaterMouseLeftUp(); // this.HandleLaterMouseRightDown(); // this.HandleLaterMouseRightUp(); // this.UpdateConmentText(gameTime); // this.UpdateSurvey(gameTime); // } // } // } //} private void HandleLaterMouseLeftDown() { //if (((this.previousMouseState.LeftButton == ButtonState.Released) && (InputManager.NowMouse.LeftButton == ButtonState.Pressed)) && (this.viewMove == ViewMove.Stop)) if (InputManager.IsDown && this.viewMove == ViewMove.Stop) { if (this.editMode) { int x = (InputManager.PoX - this.mainMapLayer.LeftEdge) / Session.Current.Scenario.ScenarioMap.TileWidth; int y = (InputManager.PoY - this.mainMapLayer.TopEdge) / Session.Current.Scenario.ScenarioMap.TileHeight; Session.Current.Scenario.ScenarioMap.MapData[x, y] = this.ditukuaidezhi; this.mainMapLayer.chongsheditukuaitupian(x, y); } else if (Session.Current.Scenario.CurrentPlayer != null && this.PeekUndoneWork().Kind == UndoneWorkKind.None && Session.Current.Scenario.CurrentPlayer == Session.Current.Scenario.CurrentFaction) { if (this.CurrentArchitecture == null && this.CurrentTroop == null && this.CurrentRouteway == null) { if (this.Plugins.youcelanPlugin.IsShowing && StaticMethods.PointInRectangle(this.MousePosition, this.Plugins.youcelanPlugin.FrameRectangle)) { } else { this.DrawingSelector = !this.Plugins.ContextMenuPlugin.IsShowing && !this.Plugins.RoutewayEditorPlugin.IsShowing; } } } } /* * if (Session.Current.Scenario.CurrentPlayer == null) return; * if (((this.previousMouseState.LeftButton == ButtonState.Released) && (InputManager.NowMouse.LeftButton == ButtonState.Pressed)) && (this.viewMove == ViewMove.Stop)) * { * if (((Session.GlobalVariables.SkyEye || Session.Current.Scenario.NoCurrentPlayer) || Session.Current.Scenario.CurrentPlayer.IsPositionKnown(this.position)) && ((this.Plugins.ContextMenuPlugin != null) && (this.PeekUndoneWork().Kind == UndoneWorkKind.None))) * { * if ((((this.CurrentArchitecture != null) && (this.CurrentTroop != null)) && (this.CurrentTroop.BelongedFaction == Session.Current.Scenario.CurrentPlayer)) && (this.CurrentArchitecture.BelongedFaction == Session.Current.Scenario.CurrentPlayer) && this.CurrentTroop.Operated == false) * { * if (!(this.Plugins.ContextMenuPlugin.IsShowing || !Session.Current.Scenario.CurrentPlayer.Controlling)) * { * this.Plugins.ContextMenuPlugin.IsShowing = true; * this.Plugins.ContextMenuPlugin.SetCurrentGameObject(this); * this.Plugins.ContextMenuPlugin.SetMenuKindByName("ArchitectureTroopLeftClick"); * this.Plugins.ContextMenuPlugin.Prepare(InputManager.NowMouse.X, InputManager.NowMouse.Y, base.viewportSize); * this.bianduiLiebiaoBiaoji = "ArchitectureTroopLeftClick"; * } * } * else if ((this.CurrentTroop != null) && (this.CurrentTroop.BelongedFaction == Session.Current.Scenario.CurrentPlayer) && this.CurrentTroop.Operated == false ) * { * if (!this.Plugins.ContextMenuPlugin.IsShowing && Session.Current.Scenario.IsPlayerControlling()) * { * this.Plugins.ContextMenuPlugin.IsShowing = true; * this.Plugins.ContextMenuPlugin.SetCurrentGameObject(this.CurrentTroop); * this.Plugins.ContextMenuPlugin.SetMenuKindByName("TroopLeftClick"); * this.Plugins.ContextMenuPlugin.Prepare(InputManager.NowMouse.X, InputManager.NowMouse.Y, base.viewportSize); * this.bianduiLiebiaoBiaoji="TroopLeftClick"; * if (!this.Plugins.ContextMenuPlugin.IsShowing && (this.CurrentTroop.CutRoutewayDays > 0)) * { * this.CurrentTroop.Leader.TextDestinationString = this.CurrentTroop.CutRoutewayDays.ToString(); * this.Plugins.tupianwenziPlugin.SetConfirmationDialog(this.Plugins.ConfirmationDialogPlugin, new GameDelegates.VoidFunction(this.CurrentTroop.StopCutRouteway), null); * this.Plugins.ConfirmationDialogPlugin.SetPosition(ShowPosition.Center); * this.Plugins.tupianwenziPlugin.SetGameObjectBranch(this.CurrentTroop.Leader, this.CurrentTroop.Leader, "StopCutRouteway"); * this.Plugins.tupianwenziPlugin.IsShowing = true; * } * } * } * else if (((this.CurrentArchitecture != null) && (this.CurrentArchitecture.BelongedFaction == Session.Current.Scenario.CurrentPlayer)) && !(this.Plugins.ContextMenuPlugin.IsShowing || !Session.Current.Scenario.IsPlayerControlling())) * { * this.Plugins.ContextMenuPlugin.IsShowing = true; * this.Plugins.ContextMenuPlugin.SetCurrentGameObject(this.CurrentArchitecture); * this.Plugins.ContextMenuPlugin.SetMenuKindByName("ArchitectureLeftClick"); * this.Plugins.ContextMenuPlugin.Prepare(InputManager.NowMouse.X, InputManager.NowMouse.Y, base.viewportSize); * * this.bianduiLiebiaoBiaoji = "ArchitectureLeftClick"; * this.ShowBianduiLiebiao(UndoneWorkKind.None, FrameKind.Military, FrameFunction.Browse , false, true, false ,true, * this.CurrentArchitecture.Militaries, this.CurrentArchitecture.ZhengzaiBuchongDeBiandui(), "", "", this.CurrentArchitecture.MilitaryPopulation); * this.ShowArchitectureSurveyPlugin(this.CurrentArchitecture); * } * } * } */ }
public object GetPropertyValue(object ClassInstance) { return(StaticMethods.GetPropertyValue(ClassInstance, this.Name)); }
public object ChangePassword([FromBody] ChangePasswordAttempt changePasswordAttempt) { try { if (Request.Headers.TryGetValue("Authorization", out Microsoft.Extensions.Primitives.StringValues value) && value.ToString().Contains("Bearer ")) { value = value.ToString().Replace("Bearer ", ""); if (changePasswordAttempt.NewPassword == changePasswordAttempt.RepeatedNewPassword && StaticMethods.IsTokenValid(value) && StaticMethods.GeneratePasswordHash(changePasswordAttempt.CurrentPassword, StaticMethods.GetUserSalt(StaticMethods.GetUserName(value))) == StaticMethods.GetUserPassword(value)) { MySQLObject mysql = new MySQLObject(); string newHash = StaticMethods.GeneratePasswordHash(changePasswordAttempt.NewPassword, StaticMethods.GetUserSalt(StaticMethods.GetUserName(value))); mysql.Update($"update `uzytkownicy` set `haslo` = '{newHash}' where `id_uzytkownika` = '{StaticMethods.GetUserId(value)}' "); return(StatusCode(200)); } else { return(StatusCode(403, @"{""Result"" : ""Wrong data""}")); } } else { return(StatusCode(403, @"{""Result"" : ""Wrong token or password""}")); } } catch { return(StatusCode(500)); } }
private void RefreshDetailDisplay() { if (this.CreatingArchitecture != null) { if (this.CreatingPersons != null) { foreach (Person person in this.CreatingPersons) { if (person.CombatTitle != null) { person.CombatTitle.Influences.PurifyInfluence(person, Applier.CombatTitle, 0); } if (person.PersonalTitle != null) { person.PersonalTitle.Influences.PurifyInfluence(person, Applier.PersonalTitle, 0); } foreach (Skill s in person.Skills.GetSkillList()) { s.Influences.PurifyInfluence(person, Applier.Skill, s.ID); } foreach (Stunt s in person.Stunts.GetStuntList()) { s.Influences.PurifyInfluence(person, Applier.Stunt, 0); } foreach (Treasure t in person.Treasures) { t.Influences.PurifyInfluence(person, Applier.Treasure, t.ID); } } } this.CreatingTroop = Troop.CreateSimulateTroop(this.CreatingArchitecture, this.CreatingPersons, this.CreatingLeader, this.CreatingMilitary, this.RationDays, this.CreatingArchitecture.Position); this.MoveCandidatesToPersons(); if ((!this.shezhizijin && !this.setttingRation && (this.CreatingMilitary != null)) && (this.CreatingPersons != null)) { /* * if (this.CreatingArchitecture.Food >= this.CreatingTroop.FoodMax) * { * this.RationDays = this.CreatingTroop.RationDays; * this.CreatingTroop.Food = this.CreatingTroop.FoodMax; * } * else * { * this.RationDays = this.CreatingArchitecture.Food / this.CreatingTroop.FoodCostPerDay; * this.CreatingTroop.Food = this.CreatingTroop.FoodCostPerDay * this.RationDays; * } */ if (!this.CreatingTroop.IsTransport) { if (this.CreatingArchitecture.Food >= this.CreatingTroop.FoodMax) { this.RationDays = this.CreatingTroop.RationDays; this.CreatingTroop.Food = this.CreatingTroop.FoodMax; } else { this.RationDays = this.CreatingArchitecture.Food / this.CreatingTroop.FoodCostPerDay; this.CreatingTroop.Food = this.CreatingTroop.FoodCostPerDay * this.RationDays; } } else { if (this.CreatingArchitecture.Food >= this.CreatingTroop.FoodCostPerDay * 20) { this.RationDays = 20; this.CreatingTroop.Food = this.CreatingTroop.FoodCostPerDay * 20; } else { this.RationDays = this.CreatingArchitecture.Food / this.CreatingTroop.FoodCostPerDay; this.CreatingTroop.Food = this.CreatingTroop.FoodCostPerDay * this.RationDays; } } } if ((this.CreatingMilitary != null) && (this.CreatingPersons != null)) { /* * if (this.CreatingArchitecture.Fund >= this.CreatingTroop.Army.zijinzuidazhi) * { * this.zijin = this.CreatingTroop.Army.zijinzuidazhi; * this.CreatingTroop.zijin = this.CreatingTroop.Army.zijinzuidazhi; * } * else * { * this.zijin = this.CreatingArchitecture.Fund; * this.CreatingTroop.zijin = this.CreatingArchitecture.Fund; * * }*/ this.CreatingTroop.zijin = this.zijin; } /* * if (this.shezhizijin) * { * this.CreatingTroop.zijin = this.zijin ; * * } */ this.MilitaryButtonEnabled = this.CreatingArchitecture.CampaignMilitaryList.Count > 1; this.PersonButtonEnabled = (this.CreatingMilitary != null) && (this.CreatingArchitecture.PersonCount > 1); this.LeaderButtonEnabled = (this.CreatingPersons != null) && (this.CreatingPersons.Count > 1); this.CreateButtonEnabled = ((this.CreatingTroop.PersonCount > 0) && (this.CreatingTroop.Leader != null)) && (this.CreatingTroop.Army != null); this.RationButtonEnabled = this.CreateButtonEnabled; this.zijinButtonEnabled = this.CreateButtonEnabled && this.CreatingTroop.IsTransport; this.TroopNameText.Text = this.CreatingTroop.DisplayName; foreach (LabelText text in this.LabelTexts) { text.Text.Text = StaticMethods.GetPropertyValue(this.CreatingTroop, text.PropertyName).ToString(); } this.OtherPersonText.Clear(); this.OtherPersonText.AddText("其他人物", Color.Yellow); this.OtherPersonText.AddNewLine(); if (this.CreatingTroop.PersonCount > 0) { int num = this.CreatingTroop.PersonCount - 1; this.OtherPersonText.AddText(num.ToString() + "人", Color.Lime); this.OtherPersonText.AddNewLine(); foreach (Person person in this.CreatingTroop.Persons) { if (person != this.CreatingTroop.Leader) { this.OtherPersonText.AddText(person.Name); this.OtherPersonText.AddNewLine(); } } } this.OtherPersonText.ResortTexts(); this.CombatMethodText.Clear(); this.CombatMethodText.AddText("部队战法", Color.Yellow); this.CombatMethodText.AddNewLine(); if (this.CreatingTroop.PersonCount > 0) { this.CombatMethodText.AddText(this.CreatingTroop.CombatMethods.Count.ToString() + "种", Color.Lime); this.CombatMethodText.AddNewLine(); foreach (CombatMethod method in this.CreatingTroop.CombatMethods.CombatMethods.Values) { this.CombatMethodText.AddText(method.Name, Color.Red); this.CombatMethodText.AddText(" 战意消耗" + ((method.Combativity - this.CreatingTroop.DecrementOfCombatMethodCombativityConsuming)).ToString(), Color.LightGreen); this.CombatMethodText.AddNewLine(); } } this.CombatMethodText.ResortTexts(); this.StuntText.Clear(); this.StuntText.AddText("战斗特技", Color.Yellow); this.StuntText.AddNewLine(); if (this.CreatingTroop.PersonCount > 0) { this.StuntText.AddText(this.CreatingTroop.Stunts.Count.ToString() + "种", Color.Lime); this.StuntText.AddNewLine(); foreach (Stunt stunt in this.CreatingTroop.Stunts.Stunts.Values) { this.StuntText.AddText(stunt.Name, Color.Red); this.StuntText.AddText(" 战意消耗" + stunt.Combativity, Color.LightGreen); this.StuntText.AddNewLine(); } } this.StuntText.ResortTexts(); this.InfluenceText.Clear(); this.InfluenceText.AddText("部队特性", Color.Yellow); this.InfluenceText.AddNewLine(); if (this.CreatingMilitary != null) { this.InfluenceText.AddText(this.CreatingMilitary.Kind.Name, Color.Lime); this.InfluenceText.AddNewLine(); foreach (Influence influence in this.CreatingMilitary.Kind.Influences.Influences.Values) { this.InfluenceText.AddText(influence.Name, Color.Red); this.InfluenceText.AddText(influence.Description, Color.LightGreen); this.InfluenceText.AddNewLine(); } } this.InfluenceText.ResortTexts(); } }
internal void SetPosition(ShowPosition showPosition) { Rectangle rectangle = new Rectangle(0, 0, this.screen.viewportSize.X, this.screen.viewportSize.Y); Rectangle centerRectangle = new Rectangle(0, 0, this.BackgroundSize.X, this.BackgroundSize.Y); ShowPosition showPosition1 = showPosition; switch (showPosition1) { case ShowPosition.Center: { centerRectangle = StaticMethods.GetCenterRectangle(rectangle, centerRectangle); break; } case ShowPosition.Top: { centerRectangle = StaticMethods.GetTopRectangle(rectangle, centerRectangle); break; } case ShowPosition.Left: { centerRectangle = StaticMethods.GetLeftRectangle(rectangle, centerRectangle); break; } case ShowPosition.Right: { centerRectangle = StaticMethods.GetRightRectangle(rectangle, centerRectangle); break; } case ShowPosition.Bottom: { centerRectangle = StaticMethods.GetBottomRectangle(rectangle, centerRectangle); break; } case ShowPosition.TopLeft: { centerRectangle = StaticMethods.GetTopLeftRectangle(rectangle, centerRectangle); break; } case ShowPosition.TopRight: { centerRectangle = StaticMethods.GetTopRightRectangle(rectangle, centerRectangle); break; } case ShowPosition.BottomLeft: { centerRectangle = StaticMethods.GetBottomLeftRectangle(rectangle, centerRectangle); break; } case ShowPosition.BottomRight: { centerRectangle = StaticMethods.GetBottomRightRectangle(rectangle, centerRectangle); break; } } this.DisplayOffset = new Point(centerRectangle.X, centerRectangle.Y); this.TroopNameText.DisplayOffset = this.DisplayOffset; List <LabelText> .Enumerator enumerator = this.LabelTexts.GetEnumerator(); try { while (true) { bool flag = enumerator.MoveNext(); if (!flag) { break; } LabelText current = enumerator.Current; current.Label.DisplayOffset = this.DisplayOffset; current.Text.DisplayOffset = this.DisplayOffset; } } finally { enumerator.Dispose(); } this.OtherPersonText.DisplayOffset = new Point(this.DisplayOffset.X + this.OtherPersonClient.X, this.DisplayOffset.Y + this.OtherPersonClient.Y); this.CombatMethodText.DisplayOffset = new Point(this.DisplayOffset.X + this.CombatMethodClient.X, this.DisplayOffset.Y + this.CombatMethodClient.Y); this.StuntText.DisplayOffset = new Point(this.DisplayOffset.X + this.StuntClient.X, this.DisplayOffset.Y + this.StuntClient.Y); this.InfluenceText.DisplayOffset = new Point(this.DisplayOffset.X + this.InfluenceClient.X, this.DisplayOffset.Y + this.InfluenceClient.Y); }
private void screen_OnMouseLeftUp(Point position) { if (this.screen.PeekUndoneWork().Kind == UndoneWorkKind.Dialog) { if (StaticMethods.PointInRectangle(position, this.OtherPersonDisplayPosition)) { if (this.OtherPersonText.CurrentPageIndex < (this.OtherPersonText.PageCount - 1)) { this.OtherPersonText.NextPage(); } else if (this.OtherPersonText.CurrentPageIndex == (this.OtherPersonText.PageCount - 1)) { this.OtherPersonText.FirstPage(); } } else if (StaticMethods.PointInRectangle(position, this.CombatMethodDisplayPosition)) { if (this.CombatMethodText.CurrentPageIndex < (this.CombatMethodText.PageCount - 1)) { this.CombatMethodText.NextPage(); } else if (this.CombatMethodText.CurrentPageIndex == (this.CombatMethodText.PageCount - 1)) { this.CombatMethodText.FirstPage(); } } else if (StaticMethods.PointInRectangle(position, this.InfluenceDisplayPosition)) { if (this.InfluenceText.CurrentPageIndex < (this.InfluenceText.PageCount - 1)) { this.InfluenceText.NextPage(); } else if (this.InfluenceText.CurrentPageIndex == (this.InfluenceText.PageCount - 1)) { this.InfluenceText.FirstPage(); } } else if (StaticMethods.PointInRectangle(position, this.MilitaryButtonDisplayPosition)) { if (this.MilitaryButtonEnabled) { this.SelectMilitary(); } } else if (StaticMethods.PointInRectangle(position, this.PersonButtonDisplayPosition)) { if (this.PersonButtonEnabled) { this.SelectPersons(); } } else if (StaticMethods.PointInRectangle(position, this.LeaderButtonDisplayPosition)) { if (this.LeaderButtonEnabled) { this.SelectLeader(); } } else if (StaticMethods.PointInRectangle(position, this.RationButtonDisplayPosition)) { if (this.RationButtonEnabled) { this.SetRation(); } } else if (StaticMethods.PointInRectangle(position, this.zijinButtonDisplayPosition)) { if (this.zijinButtonEnabled) { this.Setzijin(); } } else if (StaticMethods.PointInRectangle(position, this.CreateButtonDisplayPosition) && this.CreateButtonEnabled) { this.SelectTroopStartPosition(); } } }
internal void SetTroop(Troop troop) { bool leader; this.ShowingTroop = troop; this.TroopNameText.Text = troop.DisplayName; List <LabelText> .Enumerator enumerator = this.LabelTexts.GetEnumerator(); try { while (true) { leader = enumerator.MoveNext(); if (!leader) { break; } LabelText current = enumerator.Current; current.Text.Text = StaticMethods.GetPropertyValue(troop, current.PropertyName).ToString(); } } finally { enumerator.Dispose(); } this.OtherPersonText.AddText("其他人物", this.OtherPersonText.TitleColor); this.OtherPersonText.AddNewLine(); int personCount = troop.PersonCount - 1; this.OtherPersonText.AddText(string.Concat(personCount.ToString(), "人"), this.OtherPersonText.SubTitleColor); this.OtherPersonText.AddNewLine(); IEnumerator enumerator1 = troop.Persons.GetEnumerator(); try { while (true) { leader = enumerator1.MoveNext(); if (!leader) { break; } Person person = (Person)enumerator1.Current; leader = person != troop.Leader; if (leader) { this.OtherPersonText.AddText(person.Name); this.OtherPersonText.AddNewLine(); } } } finally { IDisposable disposable = enumerator1 as IDisposable; leader = disposable == null; if (!leader) { disposable.Dispose(); } } this.OtherPersonText.ResortTexts(); this.CombatMethodText.AddText("部队战法", this.CombatMethodText.TitleColor); this.CombatMethodText.AddNewLine(); personCount = troop.CombatMethods.Count; this.CombatMethodText.AddText(string.Concat(personCount.ToString(), "种"), this.CombatMethodText.SubTitleColor); this.CombatMethodText.AddNewLine(); Dictionary <int, CombatMethod> .ValueCollection.Enumerator enumerator2 = troop.CombatMethods.CombatMethods.Values.GetEnumerator(); try { while (true) { leader = enumerator2.MoveNext(); if (!leader) { break; } CombatMethod combatMethod = enumerator2.Current; this.CombatMethodText.AddText(combatMethod.Name, this.CombatMethodText.SubTitleColor2); personCount = combatMethod.Combativity - troop.DecrementOfCombatMethodCombativityConsuming; this.CombatMethodText.AddText(string.Concat(" 战意消耗", personCount.ToString()), this.CombatMethodText.SubTitleColor3); this.CombatMethodText.AddNewLine(); } } finally { enumerator2.Dispose(); } this.CombatMethodText.ResortTexts(); this.StuntText.AddText("部队特技", this.StuntText.TitleColor); this.StuntText.AddNewLine(); personCount = troop.Stunts.Count; this.StuntText.AddText(string.Concat(personCount.ToString(), "种"), this.StuntText.SubTitleColor); this.StuntText.AddNewLine(); Dictionary <int, Stunt> .ValueCollection.Enumerator enumerator3 = troop.Stunts.Stunts.Values.GetEnumerator(); try { while (true) { leader = enumerator3.MoveNext(); if (!leader) { break; } Stunt stunt = enumerator3.Current; this.StuntText.AddText(stunt.Name, this.StuntText.SubTitleColor2); personCount = stunt.Combativity; this.StuntText.AddText(string.Concat(" 战意消耗", personCount.ToString()), this.StuntText.SubTitleColor3); this.StuntText.AddNewLine(); } } finally { enumerator3.Dispose(); } this.StuntText.ResortTexts(); this.InfluenceText.AddText("部队特性", this.InfluenceText.TitleColor); this.InfluenceText.AddNewLine(); this.InfluenceText.AddText(this.ShowingTroop.Army.Kind.Name, this.InfluenceText.SubTitleColor); this.InfluenceText.AddNewLine(); Dictionary <int, Influence> .ValueCollection.Enumerator enumerator4 = this.ShowingTroop.Army.Kind.Influences.Influences.Values.GetEnumerator(); try { while (true) { leader = enumerator4.MoveNext(); if (!leader) { break; } Influence influence = enumerator4.Current; this.InfluenceText.AddText(influence.Name, this.InfluenceText.SubTitleColor2); this.InfluenceText.AddText(influence.Description, this.InfluenceText.SubTitleColor3); this.InfluenceText.AddNewLine(); } } finally { enumerator4.Dispose(); } this.InfluenceText.ResortTexts(); }
public void Draw() { if (this.Visible) { Rectangle?nullable; var widthHeight = this.contextMenu.LeftClickFreeTextBuilder.GetWidthHeight(this.DisplayName); var width = Convert.ToInt32(widthHeight.X); var height = Convert.ToInt32(widthHeight.Y); if (this.selected || this.open) { if (this.menuKind.IsLeft) { nullable = null; CacheManager.Draw(this.Enabled ? this.contextMenu.LeftClickItemSelectedTexture : this.contextMenu.DisabledItemSelectedTexture , this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); if (!this.open) { nullable = null; var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var scale = this.contextMenu.LeftClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, this.Enabled ? Color.White : this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } else { nullable = null; var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var color = this.Enabled ? Color.Gold : this.contextMenu.DisabledTextColor; var scale = this.contextMenu.LeftClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } } else { nullable = null; CacheManager.Draw(this.Enabled ? this.contextMenu.RightClickItemSelectedTexture : this.contextMenu.RightDisabledItemSelectedTexture, this.Position, nullable, this.Enabled ? Color.White : this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); nullable = null; var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var color = this.Enabled ? Color.White : this.contextMenu.RightDisabledTextColor; var scale = this.contextMenu.RightClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, color, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } if (this.open) { foreach (MenuItem item in this.MenuItems) { item.Draw(); } } else if (this.HasChild) { if (!this.menuKind.ShowLeft) { CacheManager.Draw(this.contextMenu.HasChildTexture, StaticMethods.CenterRectangle(new Rectangle(this.Position.Right, this.Position.Top, this.contextMenu.HasChildTexture.Width, this.Position.Height), new Rectangle(0, 0, this.contextMenu.HasChildTexture.Width, this.contextMenu.HasChildTexture.Height)), null, this.Enabled ? Color.White : this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); } else { CacheManager.Draw(this.contextMenu.HasChildTexture, StaticMethods.CenterRectangle(new Rectangle(this.Position.Left, this.Position.Top, -this.contextMenu.HasChildTexture.Width, this.Position.Height), new Rectangle(0, 0, -this.contextMenu.HasChildTexture.Width, -this.contextMenu.HasChildTexture.Height)), null, this.Enabled ? Color.White : this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); } } } else if (this.menuKind.IsLeft) { if (this.Enabled) { nullable = null; CacheManager.Draw(this.contextMenu.LeftClickItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var scale = this.contextMenu.LeftClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, this.contextMenu.LeftClickTextColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } else { nullable = null; CacheManager.Draw(this.contextMenu.DisabledItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var scale = this.contextMenu.LeftClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, this.contextMenu.DisabledTextColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } } else { if (this.Enabled) { nullable = null; CacheManager.Draw(this.contextMenu.RightClickItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var scale = this.contextMenu.RightClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, this.contextMenu.RightClickTextColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } else { nullable = null; CacheManager.Draw(this.contextMenu.RightDisabledItemTexture, this.Position, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.04f); var rec = StaticMethods.CenterRectangle(this.Position, new Rectangle(0, 0, width, height)); var pos = new Vector2(rec.X, rec.Y); var scale = this.contextMenu.RightClickFreeTextBuilder.Scale; CacheManager.DrawString(Session.Current.Font, this.DisplayName, pos, this.contextMenu.RightDisabledTextColor, 0f, Vector2.Zero, scale, SpriteEffects.None, 0.0399f); } } } }
public void Update() { Rectangle rectangle; this.FactionColor = Color.White; string meigongzuoderenshuzifuchuan; if (this.ArchitectureToSurvey.BelongedFaction != null) { this.FactionColor = this.ArchitectureToSurvey.BelongedFaction.FactionColor; } if (((this.ViewingFaction != null) && !GlobalVariables.SkyEye) && (this.ViewingFaction != this.ArchitectureToSurvey.BelongedFaction)) { this.Controlling = false; rectangle = new Rectangle(this.Left - this.BackgroundSize.X, this.Top - this.BackgroundSize.Y, this.BackgroundSize.X, this.BackgroundSize.Y); StaticMethods.AdjustRectangleInViewport(ref rectangle); this.DisplayOffset = new Point(rectangle.X, rectangle.Y); this.NameText.Text = this.ArchitectureToSurvey.Name; this.KindText.Text = this.ArchitectureToSurvey.KindString; this.FactionText.Text = this.ArchitectureToSurvey.FactionString; this.PopulationText.Text = this.ArchitectureToSurvey.PopulationInInformationLevel(this.Level); this.MilitaryPopulationText.Text = this.ArchitectureToSurvey.MilitaryPopulationInInformationLevel(this.Level); //this.ArmyText.Text = this.ArchitectureToSurvey.ArmyQuantityInInformationLevel(this.Level); //////////////////////////////////////////////////////////临时代码 ,合理的应该恢复上句并修改GameObjects.Architecture if (this.Level == InformationLevel.未知 || this.Level == InformationLevel.无 || this.Level == InformationLevel.低) { this.ArmyText.Text = this.ArchitectureToSurvey.ArmyQuantityInInformationLevel(this.Level); } else { this.ArmyText.Text = this.ArchitectureToSurvey.MilitaryCount.ToString() + "/" + this.ArchitectureToSurvey.ArmyQuantity.ToString(); } ///////////////////////////////////////////////////////////// this.DominationText.Text = this.ArchitectureToSurvey.DominationInInformationLevel(this.Level); this.EnduranceText.Text = this.ArchitectureToSurvey.EnduranceInInformationLevel(this.Level); } else { this.Controlling = true; rectangle = new Rectangle(this.Left - this.ControllingBackgroundSize.X, this.Top - this.ControllingBackgroundSize.Y, this.ControllingBackgroundSize.X, this.ControllingBackgroundSize.Y); StaticMethods.AdjustRectangleInViewport(ref rectangle); meigongzuoderenshuzifuchuan = meigongzuoderenshu(this.ArchitectureToSurvey).ToString(); this.DisplayOffset = new Point(rectangle.X, rectangle.Y); this.NameText.Text = this.ArchitectureToSurvey.Name; this.KindText.Text = this.ArchitectureToSurvey.KindString; this.FactionText.Text = this.ArchitectureToSurvey.FactionString; this.PopulationText.Text = this.ArchitectureToSurvey.Population.ToString(); this.MilitaryPopulationText.Text = this.ArchitectureToSurvey.MilitaryPopulation.ToString(); this.ArmyText.Text = this.ArchitectureToSurvey.MilitaryCount.ToString() + "/" + this.ArchitectureToSurvey.ArmyQuantity.ToString(); this.DominationText.Text = this.ArchitectureToSurvey.DominationString; this.EnduranceText.Text = this.ArchitectureToSurvey.EnduranceString; this.FundText.Text = this.ArchitectureToSurvey.Fund.ToString(); this.FoodText.Text = this.ArchitectureToSurvey.Food.ToString(); this.PersonCountText.Text = meigongzuoderenshuzifuchuan + "/" + this.ArchitectureToSurvey.PersonCount.ToString(); this.FacilityCountText.Text = this.ArchitectureToSurvey.SheshiMiaoshu; this.NoFactionPersonCountText.Text = this.ArchitectureToSurvey.NoFactionPersonCount.ToString(); this.AgricultureText.Text = this.ArchitectureToSurvey.AgricultureString; this.CommerceText.Text = this.ArchitectureToSurvey.CommerceString; this.TechnologyText.Text = this.ArchitectureToSurvey.TechnologyString; this.MoraleText.Text = this.ArchitectureToSurvey.MoraleString; } }
internal void SetPerson(Person person) { foreach (Skill skill in Session.Current.Scenario.GameCommonData.AllSkills.Skills.Values) { Rectangle position = new Rectangle(this.SkillDisplayOffset.X + (skill.DisplayCol * this.SkillBlockSize.X), this.SkillDisplayOffset.Y + (skill.DisplayRow * this.SkillBlockSize.Y), this.SkillBlockSize.X, this.SkillBlockSize.Y); this.AllSkillTexts.AddText(skill.Name, position); this.LinkedSkills.Add(skill); } this.AllSkillTexts.ResetAllAlignedPositions(); this.ShowingPerson = person; this.SurNameText.Text = person.SurName; this.GivenNameText.Text = person.GivenName; this.CalledNameText.Text = person.CalledName; foreach (LabelText text in this.LabelTexts) { text.Text.Text = StaticMethods.GetPropertyValue(person, text.PropertyName).ToString(); } this.TitleText.Clear(); foreach (Title title in person.Titles) { if (title != null) { //阿柒:根据称号等级设定不同颜色 if (title.Level < 4) { this.TitleText.AddText(" " + title.DetailedName, Color.AliceBlue); } else if (title.Level >= 4 && title.Level < 7) { this.TitleText.AddText(" " + title.DetailedName, Color.YellowGreen); } else if (title.Level >= 7 && title.Level < 10) { this.TitleText.AddText(" " + title.DetailedName, Color.LightSkyBlue); } else if (title.Level >= 10 && title.Level < 13) { this.TitleText.AddText(title.DetailedName, Color.Violet); } else { this.TitleText.AddText(title.DetailedName, Color.Orange); } } //this.TitleText.AddText(title.DetailedName, Color.DarkSlateBlue); this.TitleText.AddNewLine(); } this.TitleText.ResortTexts(); // this.GuanzhiText.Clear(); /* foreach (Guanzhi guanzhi in person.Guanzhis) * { * this.GuanzhiText.AddText(guanzhi.DetailedName, Color.Lime); * this.GuanzhiText.AddNewLine(); * } * this.GuanzhiText.ResortTexts(); */ this.PersonSkillTexts.SimpleClear(); this.LearnableSkillTexts.SimpleClear(); foreach (Skill skill in Session.Current.Scenario.GameCommonData.AllSkills.Skills.Values) { Rectangle position = new Rectangle(this.SkillDisplayOffset.X + (skill.DisplayCol * this.SkillBlockSize.X), this.SkillDisplayOffset.Y + (skill.DisplayRow * this.SkillBlockSize.Y), this.SkillBlockSize.X, this.SkillBlockSize.Y); if (person.Skills.GetSkill(skill.ID) != null) { this.PersonSkillTexts.AddText(skill.Name, position); } else if (skill.CanLearn(person)) { this.LearnableSkillTexts.AddText(skill.Name, position); } } this.PersonSkillTexts.ResetAllAlignedPositions(); this.LearnableSkillTexts.ResetAllAlignedPositions(); this.StuntText.Clear(); //阿柒:特技显示效果修改,去掉多余的字 //this.StuntText.AddText("战斗特技", Color.Yellow); //this.StuntText.AddNewLine(); //this.StuntText.AddText(person.Stunts.Count.ToString() + "种", Color.Lime); //this.StuntText.AddNewLine(); foreach (Stunt stunt in person.Stunts.Stunts.Values) { this.StuntText.AddText(stunt.Name, Color.Khaki); this.StuntText.AddText(" 战意消耗" + stunt.Combativity.ToString(), Color.SkyBlue); this.StuntText.AddNewLine(); } this.StuntText.ResortTexts(); this.BiographyText.Clear(); if (person.PersonBiography != null) { this.BiographyText.Clear(); this.BiographyText.AddText("列传", this.BiographyText.TitleColor); this.BiographyText.AddNewLine(); this.BiographyText.AddText(this.ShowingPerson.PersonBiography.Brief); this.BiographyText.AddNewLine(); this.BiographyText.AddText("演义", this.BiographyText.SubTitleColor); this.BiographyText.AddNewLine(); this.BiographyText.AddText(this.ShowingPerson.PersonBiography.Romance); this.BiographyText.AddNewLine(); this.BiographyText.AddText("历史", this.BiographyText.SubTitleColor2); this.BiographyText.AddNewLine(); this.BiographyText.AddText(this.ShowingPerson.PersonBiography.History); this.BiographyText.AddNewLine(); this.BiographyText.AddText("剧本", this.BiographyText.SubTitleColor2); this.BiographyText.AddText(":"); String[] lineBrokenText = ShowingPerson.PersonBiography.InGame.Split('\n'); foreach (String s in lineBrokenText) { this.BiographyText.AddText(s); this.BiographyText.AddNewLine(); } this.BiographyText.ResortTexts(); } }
private void screen_OnMouseLeftUp(Point position) { if (this.menuToDisplay != null) { CacheManager.Scale = Scale; /*if (this.BianduiLiebiaoXianshi == true && StaticMethods.PointInRectangle(position, this.BianduiLiebiaoWeizhi)) //光标在编队列表里点击时不关闭菜单 * { * * }*/ if ((this.HelpPlugin != null) && (this.HelpPlugin.IsButtonShowing && StaticMethods.PointInRectangle(position, this.HelpPlugin.ButtonDisplayPosition))) { this.Result = ContextMenuResult.None; this.IsShowing = false; this.HelpPlugin.IsButtonShowing = false; this.HelpPlugin.IsShowing = true; } else { MenuItem itemByPosition = this.menuToDisplay.GetItemByPosition(position); if (itemByPosition != null && itemByPosition.Enabled) { bool open = itemByPosition.Open; itemByPosition.Open = !itemByPosition.Open; if (open || itemByPosition.Open) { Session.MainGame.mainGameScreen.PlayNormalSound(this.OpenSoundFile); this.Result = ContextMenuResult.KeepShowing; } else if (itemByPosition.Name == "减小音量") { Session.MainGame.mainGameScreen.PlayNormalSound(this.ClickSoundFile); Session.MainGame.mainGameScreen.ReduceSound(); } else if (itemByPosition.Name == "增加音量") { Session.MainGame.mainGameScreen.PlayNormalSound(this.ClickSoundFile); Session.MainGame.mainGameScreen.IncreaseSound(); } else if (itemByPosition.Name == "返回初始菜单") { Session.MainGame.mainGameScreen.PlayNormalSound(this.ClickSoundFile); Session.MainGame.mainGameScreen.ReturnMainMenu(); } else { Session.MainGame.mainGameScreen.PlayNormalSound(this.ClickSoundFile); if (itemByPosition.IsParamIDItem) { this.CurrentParamID = int.Parse(itemByPosition.Param); this.Result = StaticMethods.GetContextMenuResultByName(itemByPosition.ResultDecludeParam); } else { this.Result = StaticMethods.GetContextMenuResultByName(itemByPosition.Result); } this.IsShowing = false; } } else if (!this.menuToDisplay.HasOpenItem) { Session.MainGame.mainGameScreen.PlayNormalSound(this.FoldSoundFile); this.Result = ContextMenuResult.None; this.IsShowing = false; } else { Session.MainGame.mainGameScreen.PlayNormalSound(this.FoldSoundFile); this.menuToDisplay.FoldOpenedItem(); this.Result = ContextMenuResult.KeepShowing; } } CacheManager.Scale = Vector2.One; } }
private bool IsUriInvalid(string url) => StaticMethods.IsUriInvalid(url);
public void Save(string fileName) { StaticMethods.SaveToBinaryFile(fileName, this); }
public void LoadDataFromXMLDocument(string filename) { Microsoft.Xna.Framework.Color color; Font font; XmlDocument document = new XmlDocument(); string xml = Platform.Current.LoadText(filename); document.LoadXml(xml); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.screenBlind.BackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\ScreenBlind\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.screenBlind.BackgroundClient = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(1); this.screenBlind.SpringTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\ScreenBlind\Data\" + node.Attributes.GetNamedItem("Spring").Value); this.screenBlind.SummerTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\ScreenBlind\Data\" + node.Attributes.GetNamedItem("Summer").Value); this.screenBlind.AutumnTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\ScreenBlind\Data\" + node.Attributes.GetNamedItem("Autumn").Value); this.screenBlind.WinterTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\ScreenBlind\Data\" + node.Attributes.GetNamedItem("Winter").Value); this.screenBlind.SeasonTexture = this.screenBlind.SpringTexture; node = nextSibling.ChildNodes.Item(2); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.DateText = new FreeText(font, color); this.screenBlind.DateText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.DateText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.DateText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(3); this.screenBlind.FactionClient = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.FactionText = new FreeText(font, color); this.screenBlind.FactionText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.FactionText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.FactionText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(4); this.screenBlind.SeasonClient = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(5); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.FactionTechText = new FreeText(font, color); this.screenBlind.FactionTechText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.FactionTechText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.FactionTechText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); //阿柒:新增势力信息XML设置 node = nextSibling.ChildNodes.Item(6); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.LeaderNameText = new FreeText(font, color); this.screenBlind.LeaderNameText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.LeaderNameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.LeaderNameText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(7); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.PrinceNameText = new FreeText(font, color); this.screenBlind.PrinceNameText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.PrinceNameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.PrinceNameText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(8); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.CounsellorNameText = new FreeText(font, color); this.screenBlind.CounsellorNameText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.CounsellorNameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.CounsellorNameText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(9); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.PersonCountText = new FreeText(font, color); this.screenBlind.PersonCountText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.PersonCountText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.PersonCountText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(10); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.PopulationText = new FreeText(font, color); this.screenBlind.PopulationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.PopulationText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.PopulationText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(11); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.ArmyText = new FreeText(font, color); this.screenBlind.ArmyText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.ArmyText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.ArmyText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(12); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.FundText = new FreeText(font, color); this.screenBlind.FundText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.FundText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.FundText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(13); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.FoodText = new FreeText(font, color); this.screenBlind.FoodText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.FoodText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.FoodText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(14); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.CapitalNameText = new FreeText(font, color); this.screenBlind.CapitalNameText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.CapitalNameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.CapitalNameText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(15); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.guanjuezifuchuanText = new FreeText(font, color); this.screenBlind.guanjuezifuchuanText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.guanjuezifuchuanText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.guanjuezifuchuanText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(16); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.chaotinggongxianduText = new FreeText(font, color); this.screenBlind.chaotinggongxianduText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.chaotinggongxianduText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.chaotinggongxianduText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(17); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.CityCountText = new FreeText(font, color); this.screenBlind.CityCountText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.CityCountText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.CityCountText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(18); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.FiveTigerText = new FreeText(font, color); this.screenBlind.FiveTigerText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.FiveTigerText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.FiveTigerText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); node = nextSibling.ChildNodes.Item(19); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.screenBlind.GovernorNameText = new FreeText(font, color); this.screenBlind.GovernorNameText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.screenBlind.GovernorNameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.screenBlind.GovernorNameText.DisplayOffset = new Microsoft.Xna.Framework.Point(0, 0); }
public static SettingsForSave Load(string fileName) { return((SettingsForSave)StaticMethods.LoadFromBinaryFile(fileName)); }
protected void Logout_Click(object sender, EventArgs e) { Session.Clear(); StaticMethods.UpdateStatus("Successfully logged out.", true, statusLabel); MultiViewControl.ActiveViewIndex = 0; }
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.tabList.leftedgeWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.leftedgeTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(1); this.tabList.rightedgeWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.rightedgeTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(2); this.tabList.topedgeWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.topedgeTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(3); this.tabList.bottomedgeWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.bottomedgeTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(4); this.tabList.backgroundTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(5); this.tabList.ToolTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.tabList.ToolSelectedTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.tabList.ToolDisplayTexture = this.tabList.ToolSelectedTexture; this.tabList.ToolPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(6); this.tabList.tabbuttonWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.tabbuttonHeight = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.tabList.tabbuttonTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.tabList.tabbuttonselectedTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("SelectedFileName").Value); node = nextSibling.ChildNodes.Item(7); this.tabList.columnheaderHeight = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.tabList.columnheaderTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(8); this.tabList.columnspliterWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.columnspliterHeight = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.tabList.columnspliterTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(9); this.tabList.scrollbuttonWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.scrollbuttonTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(10); this.tabList.scrolltrackWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.scrolltrackTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(11); this.tabList.leftArrowTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("LeftFileName").Value); this.tabList.rightArrowTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("RightFileName").Value); node = nextSibling.ChildNodes.Item(12); this.tabList.focusTrackTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(13); this.tabList.checkboxName = node.Attributes.GetNamedItem("Name").Value; this.tabList.checkboxDisplayName = node.Attributes.GetNamedItem("DisplayName").Value; this.tabList.checkboxWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.checkboxTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.tabList.checkboxSelectedTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("SelectedFileName").Value); this.tabList.roundcheckboxTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("RoundFileName").Value); this.tabList.roundcheckboxSelectedTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("RoundSelectedFileName").Value); node = nextSibling.ChildNodes.Item(14); this.tabList.PortraitWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.PortraitHeight = int.Parse(node.Attributes.GetNamedItem("Height").Value); node = nextSibling.ChildNodes.Item(15); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.tabList.TabTextBuilder.SetFreeTextBuilder(this.tabList.graphicsDevice, font); this.tabList.TabTextColor = color; this.tabList.TabTextAlign = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(16); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.tabList.ColumnTextBuilder.SetFreeTextBuilder(this.tabList.graphicsDevice, font); this.tabList.ColumnTextColor = color; this.tabList.ColumnTextAlign = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(17); this.tabList.SelectSoundFile = @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("Select").Value; node = nextSibling.ChildNodes.Item(18); this.tabList.TopLeftPosition.X = int.Parse(node.Attributes.GetNamedItem("X").Value); this.tabList.TopLeftPosition.Y = int.Parse(node.Attributes.GetNamedItem("Y").Value); node = nextSibling.ChildNodes.Item(19); //this.gameFrame.TopLeftWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.TopLeftTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(20); //this.gameFrame.TopRightWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.TopRightTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(21); //this.gameFrame.BottomLeftWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.BottomLeftTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(22); //this.gameFrame.BottomRightWidth = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.tabList.BottomRightTexture = Texture2D.FromFile(this.tabList.graphicsDevice, @"GameComponents\youcelan\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.tabList.LoadFromXMLNode(nextSibling.ChildNodes.Item(23)); }
public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Color color; XmlDocument document = new XmlDocument(); string xml = Platform.Current.LoadText(filename); document.LoadXml(xml); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.troopTitle.BackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.PictureNull = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("PictureNull").Value); this.troopTitle.BackgroundSize = new Microsoft.Xna.Framework.Point(int.Parse(node.Attributes.GetNamedItem("Width").Value), int.Parse(node.Attributes.GetNamedItem("Height").Value)); node = nextSibling.ChildNodes.Item(1); this.troopTitle.PortraitPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(2); this.troopTitle.FactionTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.FactionPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(3); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.NameText = new FreeText(font, color); this.troopTitle.NameText.Position = rectangle; this.troopTitle.NameText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(4); this.troopTitle.ActionDoneTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Done").Value); this.troopTitle.ActionUndoneTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Undone").Value); this.troopTitle.ActionAutoTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Auto").Value); this.troopTitle.ActionAutoDoneTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("AutoDone").Value); this.troopTitle.ActionIconPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(5); this.troopTitle.FoodNormalTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Normal").Value); this.troopTitle.FoodShortageTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Shortage").Value); this.troopTitle.FoodIconPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(6); this.troopTitle.NoControlTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("NoControl").Value); this.troopTitle.NoControlIconPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(7); this.troopTitle.StuntTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Stunt").Value); this.troopTitle.StuntIconPosition = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(8); Microsoft.Xna.Framework.Rectangle rectangle1 = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.binglitext = new FreeText(font, color); this.troopTitle.binglitext.Position = rectangle1; this.troopTitle.binglitext.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(9); this.troopTitle.shiqicaotupian = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.shiqicaoweizhi = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(10); this.troopTitle.shiqitiaotupian = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.shiqitiaoweizhi = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(15); this.troopTitle.Switch1 = node.Attributes.GetNamedItem("UIKind").Value; /* * this.troopTitle.Switch11 = node.Attributes.GetNamedItem("PersonPicture").Value; * this.troopTitle.Switch11 = node.Attributes.GetNamedItem("PersonPortrait").Value; * this.troopTitle.Switch21 = node.Attributes.GetNamedItem("FactionPicture").Value; * this.troopTitle.Switch22 = node.Attributes.GetNamedItem("FactionName").Value; * this.troopTitle.Switch23 = node.Attributes.GetNamedItem("FactionColour").Value; * this.troopTitle.Switch31 = node.Attributes.GetNamedItem("TroopKind").Value; * this.troopTitle.Switch36 = node.Attributes.GetNamedItem("Food").Value; * this.troopTitle.Switch37 = node.Attributes.GetNamedItem("Stunt").Value; * this.troopTitle.Switch38 = node.Attributes.GetNamedItem("Action").Value; * this.troopTitle.Switch41 = node.Attributes.GetNamedItem("shiqi").Value; * this.troopTitle.Switch42 = node.Attributes.GetNamedItem("zhanyi").Value; */ node = nextSibling.ChildNodes.Item(21); this.troopTitle.TheBackground1Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheBackground1 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Background").Value); this.troopTitle.TheMask11 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask1").Value); this.troopTitle.TheMask12 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask2").Value); this.troopTitle.TheMask13 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask3").Value); this.troopTitle.TheMask14 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask4").Value); node = nextSibling.ChildNodes.Item(22); this.troopTitle.ThePortrait1Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(26); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.FactionName1Text = new FreeText(font, color); this.troopTitle.FactionName1Text.Position = rectangle; this.troopTitle.FactionName1Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.troopTitle.FactionName1Position.X = int.Parse(node.Attributes.GetNamedItem("X").Value); this.troopTitle.FactionName1Position.Y = int.Parse(node.Attributes.GetNamedItem("Y").Value); this.troopTitle.FactionName1Position.Width = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.troopTitle.FactionName1Position.Height = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.troopTitle.FactionName1Kind = node.Attributes.GetNamedItem("FactionNameKind").Value; this.troopTitle.ShowFactionName1Background = node.Attributes.GetNamedItem("ShowFactionNameBackground").Value; this.troopTitle.FactionName1Background = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\FactionPicture\" + node.Attributes.GetNamedItem("Background").Value); node = nextSibling.ChildNodes.Item(27); this.troopTitle.FactionColor1Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.FactionColor1Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\FactionPicture\" + node.Attributes.GetNamedItem("ColorPicture").Value); this.troopTitle.FactionColor1Background = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\FactionPicture\" + node.Attributes.GetNamedItem("ColorBackground").Value); node = nextSibling.ChildNodes.Item(31); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.TroopName1Text = new FreeText(font, color); this.troopTitle.TroopName1Text.Position = rectangle; this.troopTitle.TroopName1Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(36); this.troopTitle.TheTroopKind1Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheTroopKind11Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind1").Value); this.troopTitle.TheTroopKind12Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind2").Value); this.troopTitle.TheTroopKind13Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind3").Value); this.troopTitle.TheTroopKind14Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind4").Value); this.troopTitle.TheTroopKind15Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind5").Value); node = nextSibling.ChildNodes.Item(37); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.Thebingli1Text = new FreeText(font, color); this.troopTitle.Thebingli1Text.Position = rectangle; this.troopTitle.Thebingli1Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(41); this.troopTitle.TheActionIcon1Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheActionDone1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Done").Value); this.troopTitle.TheActionUndone1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Undone").Value); this.troopTitle.TheActionAuto1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Auto").Value); this.troopTitle.TheActionAutoDone1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("AutoDone").Value); node = nextSibling.ChildNodes.Item(42); this.troopTitle.TheFoodIcon1Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheFoodNormal1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Normal").Value); this.troopTitle.TheFoodShortage1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Shortage").Value); node = nextSibling.ChildNodes.Item(43); this.troopTitle.TheNoControl1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("NoControl").Value); this.troopTitle.TheNoControlIcon1Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(44); this.troopTitle.TheStunt1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Stunt").Value); this.troopTitle.TheStuntIcon1Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(46); this.troopTitle.Theshiqi1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.Theshiqi1Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(47); this.troopTitle.Thezhanyi1Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.Thezhanyi1Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(51); this.troopTitle.TheBackground2Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheBackground2 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Background").Value); this.troopTitle.TheMask21 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask1").Value); this.troopTitle.TheMask22 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask2").Value); this.troopTitle.TheMask23 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask3").Value); this.troopTitle.TheMask24 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\" + node.Attributes.GetNamedItem("Mask4").Value); node = nextSibling.ChildNodes.Item(52); this.troopTitle.ThePortrait2Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(56); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.FactionName2Text = new FreeText(font, color); this.troopTitle.FactionName2Text.Position = rectangle; this.troopTitle.FactionName2Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); this.troopTitle.FactionName2Position.X = int.Parse(node.Attributes.GetNamedItem("X").Value); this.troopTitle.FactionName2Position.Y = int.Parse(node.Attributes.GetNamedItem("Y").Value); this.troopTitle.FactionName2Position.Width = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.troopTitle.FactionName2Position.Height = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.troopTitle.FactionName2Kind = node.Attributes.GetNamedItem("FactionNameKind").Value; this.troopTitle.ShowFactionName2Background = node.Attributes.GetNamedItem("ShowFactionNameBackground").Value; this.troopTitle.FactionName2Background = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\FactionPicture\" + node.Attributes.GetNamedItem("Background").Value); node = nextSibling.ChildNodes.Item(57); this.troopTitle.FactionColor2Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.FactionColor2Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\FactionPicture\" + node.Attributes.GetNamedItem("ColorPicture").Value); this.troopTitle.FactionColor2Background = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\FactionPicture\" + node.Attributes.GetNamedItem("ColorBackground").Value); node = nextSibling.ChildNodes.Item(61); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.TroopName2Text = new FreeText(font, color); this.troopTitle.TroopName2Text.Position = rectangle; this.troopTitle.TroopName2Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(66); this.troopTitle.TheTroopKind2Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheTroopKind21Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind1").Value); this.troopTitle.TheTroopKind22Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind2").Value); this.troopTitle.TheTroopKind23Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind3").Value); this.troopTitle.TheTroopKind24Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind4").Value); this.troopTitle.TheTroopKind25Picture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\TroopKind\" + node.Attributes.GetNamedItem("TroopKind5").Value); node = nextSibling.ChildNodes.Item(67); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.troopTitle.Thebingli2Text = new FreeText(font, color); this.troopTitle.Thebingli2Text.Position = rectangle; this.troopTitle.Thebingli2Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(71); this.troopTitle.TheActionIcon2Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheActionDone2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Done").Value); this.troopTitle.TheActionUndone2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Undone").Value); this.troopTitle.TheActionAuto2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Auto").Value); this.troopTitle.TheActionAutoDone2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("AutoDone").Value); node = nextSibling.ChildNodes.Item(72); this.troopTitle.TheFoodIcon2Position = StaticMethods.LoadRectangleFromXMLNode(node); this.troopTitle.TheFoodNormal2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Normal").Value); this.troopTitle.TheFoodShortage2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Shortage").Value); node = nextSibling.ChildNodes.Item(73); this.troopTitle.TheNoControl2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("NoControl").Value); this.troopTitle.TheNoControlIcon2Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(74); this.troopTitle.TheStunt2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("Stunt").Value); this.troopTitle.TheStuntIcon2Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(76); this.troopTitle.Theshiqi2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.Theshiqi2Position = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(77); this.troopTitle.Thezhanyi2Texture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TroopTitle\Data\Icon\" + node.Attributes.GetNamedItem("FileName").Value); this.troopTitle.Thezhanyi2Position = StaticMethods.LoadRectangleFromXMLNode(node); }