public ShipUiIndication(IUIElement raw) : base(raw) { ManeuverType = LabelText?.OrderBy(label => label.RegionCenter()?.B)?.FirstOrDefault()?.Text?.ManeuverTypeFromShipUiIndicationText(); }
public void LoadDataFromXMLDocument(string filename) { XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.marshalSectionDialog.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.marshalSectionDialog.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); node = nextSibling.ChildNodes.Item(1); for (int i = 0; i < node.ChildNodes.Count; i += 2) { Font font; Microsoft.Xna.Framework.Graphics.Color color; LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Label.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.marshalSectionDialog.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(2); this.marshalSectionDialog.OKButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.OKButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.OKButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.marshalSectionDialog.OKButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.OKButtonDisplayTexture = this.marshalSectionDialog.OKButtonDisabledTexture; node = nextSibling.ChildNodes.Item(3); this.marshalSectionDialog.CancelButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.CancelButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.CancelButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.marshalSectionDialog.CancelButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.CancelButtonDisplayTexture = this.marshalSectionDialog.CancelButtonTexture; node = nextSibling.ChildNodes.Item(4); this.marshalSectionDialog.ArchitectureListButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.ArchitectureListButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.ArchitectureListButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.ArchitectureListButtonDisplayTexture = this.marshalSectionDialog.ArchitectureListButtonTexture; node = nextSibling.ChildNodes.Item(5); this.marshalSectionDialog.AIDetailButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.AIDetailButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.AIDetailButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.AIDetailButtonDisplayTexture = this.marshalSectionDialog.AIDetailButtonTexture; node = nextSibling.ChildNodes.Item(6); this.marshalSectionDialog.OrientationButtonTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.marshalSectionDialog.OrientationButtonSelectedTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.marshalSectionDialog.OrientationButtonDisabledTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\MarshalSectionDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.marshalSectionDialog.OrientationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.marshalSectionDialog.OrientationButtonDisplayTexture = this.marshalSectionDialog.OrientationButtonDisabledTexture; }
public override void Update(SharpDL.GameTime gameTime) { if (!Visible) { return; } iconFrame.Update(gameTime); if (IsFocused) { timeSinceLastUpdate += gameTime.ElapsedGameTime; if (timeSinceLastUpdate > TimeSpan.FromSeconds(0.5)) { IconInputBar.Visible = true; timeSinceVisibleTrue += gameTime.ElapsedGameTime; if (timeSinceVisibleTrue > TimeSpan.FromSeconds(0.5)) { timeSinceLastUpdate = TimeSpan.Zero; timeSinceVisibleTrue = TimeSpan.Zero; } } else { IconInputBar.Visible = false; } IconInputBar.Update(gameTime); LabelText.Update(gameTime); } base.Update(gameTime); }
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.treasureDetail.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.treasureDetail.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.treasureDetail.BackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TreasureDetail\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(1); this.treasureDetail.PictureClient = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(2); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(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(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.treasureDetail.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(3); this.treasureDetail.DescriptionClient = StaticMethods.LoadRectangleFromXMLNode(node); this.treasureDetail.DescriptionText.ClientWidth = this.treasureDetail.DescriptionClient.Width; this.treasureDetail.DescriptionText.ClientHeight = this.treasureDetail.DescriptionClient.Height; this.treasureDetail.DescriptionText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.treasureDetail.DescriptionText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.treasureDetail.DescriptionText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.treasureDetail.DescriptionText.Builder = font; //.SetFreeTextBuilder(font); this.treasureDetail.DescriptionText.DefaultColor = color; node = nextSibling.ChildNodes.Item(4); this.treasureDetail.InfluenceClient = StaticMethods.LoadRectangleFromXMLNode(node); this.treasureDetail.InfluenceText.ClientWidth = this.treasureDetail.InfluenceClient.Width; this.treasureDetail.InfluenceText.ClientHeight = this.treasureDetail.InfluenceClient.Height; this.treasureDetail.InfluenceText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.treasureDetail.InfluenceText.Builder = font; //.SetFreeTextBuilder(font); this.treasureDetail.InfluenceText.DefaultColor = color; }
public FormClient() { InitializeComponent(); rtbText = new RTBText(msgSetText); rtbTextState = new RTBTextState(msgSetTextState); lblText = new LabelText(msgSetLabel); //_client.IsUV = false; }
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); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.factionTechniques.CommentsText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.factionTechniques.CommentsText.DefaultColor = color; }
public void LoadDataFromXMLDocument(string filename) { Font font; Microsoft.Xna.Framework.Graphics.Color color; XmlDocument document = new XmlDocument(); document.Load(filename); XmlNode nextSibling = document.FirstChild.NextSibling; XmlNode node = nextSibling.ChildNodes.Item(0); this.architectureDetail.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.architectureDetail.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.architectureDetail.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\ArchitectureDetail\Data\" + node.Attributes.GetNamedItem("FileName").Value); node = nextSibling.ChildNodes.Item(1); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); Microsoft.Xna.Framework.Rectangle rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(this.graphicsDevice, font, color); item.Label.Position = rectangle; item.Label.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); rectangle = StaticMethods.LoadRectangleFromXMLNode(node3); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(this.graphicsDevice, font, color); item.Text.Position = rectangle; item.Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.architectureDetail.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(2); this.architectureDetail.CharacteristicClient = StaticMethods.LoadRectangleFromXMLNode(node); this.architectureDetail.CharacteristicText.ClientWidth = this.architectureDetail.CharacteristicClient.Width; this.architectureDetail.CharacteristicText.ClientHeight = this.architectureDetail.CharacteristicClient.Height; this.architectureDetail.CharacteristicText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.architectureDetail.CharacteristicText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.architectureDetail.CharacteristicText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.architectureDetail.CharacteristicText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.architectureDetail.CharacteristicText.DefaultColor = color; node = nextSibling.ChildNodes.Item(3); this.architectureDetail.FacilityClient = StaticMethods.LoadRectangleFromXMLNode(node); this.architectureDetail.FacilityText.ClientWidth = this.architectureDetail.FacilityClient.Width; this.architectureDetail.FacilityText.ClientHeight = this.architectureDetail.FacilityClient.Height; this.architectureDetail.FacilityText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.architectureDetail.FacilityText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.architectureDetail.FacilityText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.architectureDetail.FacilityText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); this.architectureDetail.FacilityText.SubTitleColor3 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.architectureDetail.FacilityText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.architectureDetail.FacilityText.DefaultColor = color; }
private void FormServer_Load(object sender, EventArgs e) { rtbText = new RTBText(msgSetText); lblText = new LabelText(msgLabelSetText); Dictionary <int, int> temp = new Dictionary <int, int>(); this.serverFacade.ConnectHandler_Show += serverFacade_ConnectHandler_Show; this.serverFacade.MsgHandler_Show += serverFacade_MsgHandler_Show; }
protected override IEnumerator ProcessPayload(VisualPayload payload) { var label = VisualizerFactory.InstantiateLabelVisualizerPrefab(); label.Initialize(this, payload); var meshRenderer = label.TextComponent.GetComponent <MeshRenderer>(); var targetFont = FontFactory.GetFontPair(FontName.GetFirstValue(payload.Data)); var newMaterial = FontFactory.GenerateNewSpatialMaterial(targetFont.FontTexture); label.TextComponent.font = targetFont.Font; label.TextComponent.fontSize = Mathf.FloorToInt(FontSize.GetFirstValue(payload.Data) * targetFont.FontScale); label.transform.localPosition = new Vector3(0f, label.TextComponent.fontSize * targetFont.VerticalOffset, 0f); label.CharactersPerLine = CharactersPerLine.GetFirstValue(payload.Data); label.MaxLines = MaxLines.GetFirstValue(payload.Data); newMaterial.color = FontColor.GetFirstValue(payload.Data); meshRenderer.material = newMaterial; label.BackgroundPadding = BackgroundPadding.GetFirstValue(payload.Data); label.BackgroundDepth = BackgroundDepth.GetFirstValue(payload.Data); label.LateralJustification = Justification.GetFirstValue(payload.Data); label.VerticalJustification = VerticalJustification.GetFirstValue(payload.Data); label.MinHeight = MinHeight.GetFirstValue(payload.Data); label.MaxHeight = MaxHeight.GetFirstValue(payload.Data); label.Orientation = Orientation.GetFirstValue(payload.Data); label.SetClickState(ClickState); label.RemoveBackground = !ShowBackground.GetFirstValue(payload.Data); label.Text = LabelText.GetFirstValue(payload.Data); var newPayload = new VisualPayload(payload.Data, new VisualDescription(label.Bound)); var iterator = DefaultState.Transmit(newPayload); while (iterator.MoveNext()) { yield return(null); } }
private string GetLabelText(ICommandContext context, IMessage repliedMessage) { const StringComparison comp = StringComparison.InvariantCultureIgnoreCase; string result = LabelText .Replace("$User", context.User.Username, comp) .Replace("$Message", context.Message.Content, comp) .Replace("$RepliedUser", repliedMessage.Author.Username, comp) .Replace("$RepliedMessage", repliedMessage.Content, comp) .Replace("$Guild", context.Guild?.Name, comp); return(result); }
private void Dispose(bool disposing) { if (IconFrame != null) { IconFrame.Dispose(); } if (IconInputBar != null) { IconInputBar.Dispose(); } if (LabelText != null) { LabelText.Dispose(); } }
public static string getLabelText(LabelText lt) { switch (lt) { case LabelText.PCT: return("EFF %"); case LabelText.Null: return(""); case LabelText.Duration: return("DUR"); default: return(lt.ToString()); } }
public override void Draw(SharpDL.GameTime gameTime, Renderer renderer) { if (!Visible) { return; } iconFrame.Draw(gameTime, renderer); if (IsFocused) { IconInputBar.Draw(gameTime, renderer); } if (HasText) { LabelText.Draw(gameTime, renderer); } }
internal void Draw(SpriteBatch spriteBatch) { bool showingTroop = this.ShowingTroop != null; if (showingTroop) { Rectangle?nullable = null; spriteBatch.Draw(this.BackgroundTexture, this.BackgroundDisplayPosition, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.2f); nullable = null; try { spriteBatch.Draw(this.ShowingTroop.Leader.SmallPortrait, this.PortraitDisplayPosition, nullable, Color.White, 0f, Vector2.Zero, SpriteEffects.None, 0.199f); } catch { } this.TroopNameText.Draw(spriteBatch, 0.1999f); List <LabelText> .Enumerator enumerator = this.LabelTexts.GetEnumerator(); try { while (true) { showingTroop = enumerator.MoveNext(); if (!showingTroop) { break; } LabelText current = enumerator.Current; current.Label.Draw(spriteBatch, 0.1999f); current.Text.Draw(spriteBatch, 0.1999f); } } finally { enumerator.Dispose(); } this.OtherPersonText.Draw(spriteBatch, 0.1999f); this.CombatMethodText.Draw(spriteBatch, 0.1999f); this.StuntText.Draw(spriteBatch, 0.1999f); this.InfluenceText.Draw(spriteBatch, 0.1999f); } }
void ReleaseDesignerOutlets() { if (ButtonText != null) { ButtonText.Dispose(); ButtonText = null; } if (LabelText != null) { LabelText.Dispose(); LabelText = null; } if (TextField != null) { TextField.Dispose(); TextField = null; } }
protected void PrepareForInputGroup(TagHelperContext context, TagHelperOutput output) { if (InputGroupContext != null) { if (LabelText.IsNotNullOrEmpty()) { InputGroupContext.LabelText = LabelText; LabelText = null; } if (HelpText.IsNotNullOrEmpty()) { InputGroupContext.HelpText = HelpText; HelpText = null; } if (AspFor != null) { if (IsNeedValidation.GetValueOrDefault() || IsNeedValidationMessage.GetValueOrDefault()) { InputGroupContext.AspFor = AspFor; InputGroupContext.MvcTagHelperOutput = MvcTagHelperOutput; InputGroupContext.IsNeedValidation = IsNeedValidation; InputGroupContext.IsNeedValidationMessage = IsNeedValidationMessage; IsNeedValidationMessage = false; } } if (IsFormHorizontal) { InputGroupContext.IsFormHorizontal = IsFormHorizontal; IsFormHorizontal = false; } } }
private void LabelTextChanged() { bool isBlank = (LabelText.Length == 0); // Strip leading non-unique prefix and the trailing annotation. string trimLabel = Symbol.TrimAndValidateLabel(LabelText, mFormatter.NonUniqueLabelPrefix, out bool isValid, out bool isLenValid, out bool isFirstCharValid, out bool hasNonUniquePrefix, out Symbol.LabelAnnotation anno); // If they type '@'/':'/'.' at the start of the label, switch the radio button. // Alternatively, if they choose a different radio button, remove the prefix. // We only want to do this on the first event so we don't wedge the control. if (hasNonUniquePrefix && !mHadNonUniquePrefix && !IsNonUniqueChecked) { IsNonUniqueChecked = true; } else if (hasNonUniquePrefix && mHadNonUniquePrefix && !IsNonUniqueChecked) { LabelText = LabelText.Substring(1); hasNonUniquePrefix = false; } mHadNonUniquePrefix = hasNonUniquePrefix; if (isBlank || isLenValid) { maxLengthLabel.Foreground = mDefaultLabelColor; } else { maxLengthLabel.Foreground = Brushes.Red; } if (isBlank || isFirstCharValid) { firstLetterLabel.Foreground = mDefaultLabelColor; } else { firstLetterLabel.Foreground = Brushes.Red; } if (isBlank || isValid) { // TODO(maybe): if the problem is that the label starts with a number, we // shouldn't light up this (which is the "valid chars are" label) as well. validCharsLabel.Foreground = mDefaultLabelColor; } else { validCharsLabel.Foreground = Brushes.Red; } #if false if (hasNonUniqueTag) { IsNonUniqueChecked = true; IsLocalEnabled = IsGlobalEnabled = IsExportedEnabled = false; } else { IsNonUniqueEnabled = IsLocalEnabled = IsGlobalEnabled = IsExportedEnabled = true; } #endif // Refuse to continue if the label already exists and this isn't a non-unique label. // The only exception is if it's the same symbol, and it's user-defined. (If // they're trying to edit an auto label, we want to force them to change the name.) // // NOTE: if label matching is case-insensitive, we want to allow a situation // where a label is being renamed from "FOO" to "Foo". We should be able to // test for object equality on the Symbol to determine if we're renaming a // symbol to itself. if (!IsNonUniqueChecked && isValid && mSymbolTable.TryGetValue(trimLabel, out Symbol sym) && (sym != LabelSym || LabelSym.SymbolSource != Symbol.Source.User)) { isValid = false; notDuplicateLabel.Foreground = Brushes.Red; } else if (IsNonUniqueChecked) { notDuplicateLabel.Foreground = Brushes.Gray; } else { notDuplicateLabel.Foreground = mDefaultLabelColor; } IsValid = isBlank || isValid; }
public void LoadDataFromXMLDocument(string filename) { XmlNode node3; 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.personDetail.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.personDetail.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.personDetail.BackgroundTexture = Texture2D.FromFile(this.graphicsDevice, @"GameComponents\PersonDetail\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.personDetail.SurNameText = new FreeText(this.graphicsDevice, font, color); this.personDetail.SurNameText.Position = rectangle; this.personDetail.SurNameText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(2); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.GivenNameText = new FreeText(this.graphicsDevice, font, color); this.personDetail.GivenNameText.Position = rectangle; this.personDetail.GivenNameText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(3); rectangle = StaticMethods.LoadRectangleFromXMLNode(node); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.CalledNameText = new FreeText(this.graphicsDevice, font, color); this.personDetail.CalledNameText.Position = rectangle; this.personDetail.CalledNameText.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(4); this.personDetail.PortraitClient = StaticMethods.LoadRectangleFromXMLNode(node); node = nextSibling.ChildNodes.Item(5); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); 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.personDetail.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(6); this.personDetail.TitleClient = StaticMethods.LoadRectangleFromXMLNode(node); this.personDetail.TitleText.ClientWidth = this.personDetail.TitleClient.Width; this.personDetail.TitleText.ClientHeight = this.personDetail.TitleClient.Height; this.personDetail.TitleText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.TitleText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.personDetail.TitleText.DefaultColor = color; node = nextSibling.ChildNodes.Item(7); this.personDetail.SkillBlockSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.personDetail.SkillBlockSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.personDetail.SkillDisplayOffset.X = int.Parse(node.Attributes.GetNamedItem("OffsetX").Value); this.personDetail.SkillDisplayOffset.Y = int.Parse(node.Attributes.GetNamedItem("OffsetY").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.AllSkillTexts = new FreeTextList(this.graphicsDevice, font, color); this.personDetail.AllSkillTexts.Align = (TextAlign) Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); Microsoft.Xna.Framework.Graphics.Color color2 = new Microsoft.Xna.Framework.Graphics.Color { PackedValue = uint.Parse(node.Attributes.GetNamedItem("SkillColor").Value) }; this.personDetail.PersonSkillTexts = new FreeTextList(this.graphicsDevice, font, color2); this.personDetail.PersonSkillTexts.Align = this.personDetail.AllSkillTexts.Align; Microsoft.Xna.Framework.Graphics.Color color3 = new Microsoft.Xna.Framework.Graphics.Color { PackedValue = uint.Parse(node.Attributes.GetNamedItem("LearnableColor").Value) }; this.personDetail.LearnableSkillTexts = new FreeTextList(this.graphicsDevice, font, color3); this.personDetail.LearnableSkillTexts.Align = this.personDetail.AllSkillTexts.Align; node = nextSibling.ChildNodes.Item(8); this.personDetail.StuntClient = StaticMethods.LoadRectangleFromXMLNode(node); this.personDetail.StuntText.ClientWidth = this.personDetail.StuntClient.Width; this.personDetail.StuntText.ClientHeight = this.personDetail.StuntClient.Height; this.personDetail.StuntText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.StuntText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.personDetail.StuntText.DefaultColor = color; node = nextSibling.ChildNodes.Item(9); this.personDetail.InfluenceClient = StaticMethods.LoadRectangleFromXMLNode(node); this.personDetail.InfluenceText.ClientWidth = this.personDetail.InfluenceClient.Width; this.personDetail.InfluenceText.ClientHeight = this.personDetail.InfluenceClient.Height; this.personDetail.InfluenceText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.personDetail.InfluenceText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.personDetail.InfluenceText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.personDetail.InfluenceText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); this.personDetail.InfluenceText.SubTitleColor3 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.InfluenceText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.personDetail.InfluenceText.DefaultColor = color; node = nextSibling.ChildNodes.Item(10); this.personDetail.ConditionClient = StaticMethods.LoadRectangleFromXMLNode(node); this.personDetail.ConditionText.ClientWidth = this.personDetail.ConditionClient.Width; this.personDetail.ConditionText.ClientHeight = this.personDetail.ConditionClient.Height; this.personDetail.ConditionText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.personDetail.ConditionText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.personDetail.ConditionText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.personDetail.ConditionText.PositiveColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("PositiveColor").Value); this.personDetail.ConditionText.NegativeColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("NegativeColor").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.ConditionText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.personDetail.ConditionText.DefaultColor = color; node = nextSibling.ChildNodes.Item(11); this.personDetail.BiographyClient = StaticMethods.LoadRectangleFromXMLNode(node); this.personDetail.BiographyText.ClientWidth = this.personDetail.BiographyClient.Width; this.personDetail.BiographyText.ClientHeight = this.personDetail.BiographyClient.Height; this.personDetail.BiographyText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); this.personDetail.BiographyText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.personDetail.BiographyText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.personDetail.BiographyText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.BiographyText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.personDetail.BiographyText.DefaultColor = color; /* node = nextSibling.ChildNodes.Item(12); this.personDetail.GuanzhiClient = StaticMethods.LoadRectangleFromXMLNode(node); this.personDetail.GuanzhiText.ClientWidth = this.personDetail.GuanzhiClient.Width; this.personDetail.GuanzhiText.ClientHeight = this.personDetail.GuanzhiClient.Height; this.personDetail.GuanzhiText.RowMargin = int.Parse(node.Attributes.GetNamedItem("RowMargin").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.personDetail.GuanzhiText.Builder.SetFreeTextBuilder(this.graphicsDevice, font); this.personDetail.GuanzhiText.DefaultColor = color; */ }
public override int GetHashCode() { return(LabelName.GetHashCode() ^ LabelText.GetHashCode()); }
static public IWindowAgentDialogue Parse(this MemoryStruct.IWindowAgentDialogue Window) { if (null == Window) { return(null); } IWindowAgentPane LeftPane = null; IWindowAgentPane RightPane = null; MemoryStruct.IUIElement AcceptButton = null; MemoryStruct.IUIElement DeclineButton = null; MemoryStruct.IUIElement CloseButton = null; MemoryStruct.IUIElement CompleteButton = null; MemoryStruct.IUIElement QuitButton = null; MemoryStruct.IUIElement DelayButton = null; DialogueMission Mission = null; try { LeftPane = Window?.LeftPane?.Parse(); RightPane = Window?.RightPane?.Parse(); var Objective = RightPane?.Objective; Mission = null == Objective ? null : new DialogueMission() { Title = LeftPane?.Caption, Objective = Objective, Reward = RightPane?.Reward, }; var ButtonContainingTextIgnoringCase = new Func <string, MemoryStruct.IUIElement>( LabelText => Window?.ButtonText?.FirstOrDefault(Button => Button?.Text?.ToLower()?.Contains(LabelText?.ToLower()) ?? false)); AcceptButton = ButtonContainingTextIgnoringCase("Accept"); DeclineButton = ButtonContainingTextIgnoringCase("Decline"); CloseButton = ButtonContainingTextIgnoringCase("Close"); CompleteButton = ButtonContainingTextIgnoringCase("Complete"); QuitButton = ButtonContainingTextIgnoringCase("Quit"); DelayButton = ButtonContainingTextIgnoringCase("Delay"); } catch { } return(new WindowAgentDialogue() { Raw = Window, LeftPane = LeftPane, RightPane = RightPane, Mission = Mission, AcceptButton = AcceptButton, DeclineButton = DeclineButton, CloseButton = CloseButton, CompleteButton = CompleteButton, QuitButton = QuitButton, DelayButton = DelayButton, }); }
public override void Process(TagHelperContext context, TagHelperOutput output) { (_htmlHelper as IViewContextAware).Contextualize(ViewContext); var prefix = ViewContext.ViewData.TemplateInfo.HtmlFieldPrefix; var htmlId = prefix.IsEmpty() ? ModelItem.Metadata.PropertyName : _htmlHelper.IdForModel() + "_" + ModelItem.Metadata.PropertyName; var htmlName = prefix.IsEmpty() ? ModelItem.Metadata.PropertyName : prefix + "." + ModelItem.Metadata.PropertyName; output.TagName = "div"; output.TagMode = TagMode.StartTagAndEndTag; var labelText = ModelItem.Metadata.DisplayName ?? ModelItem.Metadata.PropertyName ?? htmlId.Split('.').Last(); if (!FieldName.IsEmpty()) { htmlId = FieldName; htmlName = FieldName; } if (!LabelText.IsEmpty()) { labelText = LabelText; } var initalJson = string.Empty; var selectionJs = string.Empty; if (ItemList != null && ItemList.Count > 0) { var json = "["; var fistItem = true; foreach (var value in ItemList) { if (!fistItem) { json += ","; } json += "{id: " + value.Id + ", text: \"" + value.Name + "\"}"; fistItem = false; } json += "]"; initalJson = string.Format("$('#{0}').select2('data', {1});", htmlId, json); } else { selectionJs = $@"initSelection: function(element, callback) {{ var id = $(element).val(); if (id != '') {{ $.ajax('{LoaderUrl}/' + id, {{ dataType: 'json' }}).done(function(data) {{ callback(data); }}); }} }}"; } string js = DisableJs ? "" : $@"<script type=""text/javascript""> $(function () {{ $(""#{htmlId}"").select2({{ placeholder: ""{PlaceHolderText}"", {(CanClearSelect ? "allowClear: true, " : "")} {(MultiSelect ? "multiple:true," : "")} minimumInputLength: 1, ajax: {{ url: '{Url}', dataType: 'json', data: function (term, page) {{ return {{ q: term, {(!ParentComboBox.IsEmpty() ? $"id: $('#{ParentComboBox}').val()," : "")} }}; }}, results: function (data, page) {{ return {{ results: data }}; }} }}, {selectionJs} }}); {initalJson} }}); </script>"; var valHtml = ModelItem != null ? "value='" + ModelItem.Model + "'" : ""; if (DisableEditorTemplate) { if (!AddNewUrl.IsEmpty()) { var sep = "?"; if (AddNewUrl.Contains("?")) { sep = "&"; } AddNewUrl += sep + "editorId=" + htmlId; output.Content.SetHtmlContent($@" <div class=""input-group""> <input id='{htmlId}' name='{htmlName}' type='text' class='form-control input-sm {CssClass}' {valHtml} /> <span class=""input-group-btn""> <a href='{AddNewUrl}' class='btn btn-xs btn-primary btnAddPopup fancyboxAdd fancybox.iframe'><i class='fa fa-plus'></i></a> </span> {js} </div>"); } else { output.Content.SetHtmlContent($@" <input id='{htmlId}' name='{htmlName}' type='text' class='form-control input-sm {CssClass}' {valHtml} /> {js}"); } } else { if (!DisableFormGroup) { output.Attributes.Add("class", "form-group"); output.Attributes.Add("id", "div" + htmlId); } else { output.TagName = "span"; } var irq = (!IsRequired.HasValue && ModelItem.Metadata.GetIsRequired()) || (IsRequired.HasValue && IsRequired.Value); var requiredHtml = irq ? $"<span class=\"{RequiredCssClass}\">{Symbol}</span>" : ""; var metaHtml = irq ? $"<span class=\"field-validation-valid help-block\" data-valmsg-for=\"{htmlId}\" data-valmsg-replace=\"true\"></span>" : ""; if (!AddNewUrl.IsEmpty()) { var sep = "?"; if (AddNewUrl.Contains("?")) { sep = "&"; } AddNewUrl += sep + "editorId=" + htmlId; output.Content.SetHtmlContent($@" <label class=""col-xs-{LabelColCount} control-label"">{labelText} {requiredHtml}</label> <div class=""col-xs-{EditorColCount}""> <div class=""input-group""> <input id='{htmlId}' name='{htmlName}' type='text' class='form-control input-sm {CssClass}' {valHtml} /> <span class=""input-group-btn""> <a href='{AddNewUrl}' class='btn btn-xs btn-primary btnAddPopup fancyboxAdd fancybox.iframe'><i class='fa fa-plus'></i></a> </span> </div> {metaHtml} </div> {js}"); } else { output.Content.SetHtmlContent($@" <label class=""col-xs-{LabelColCount} control-label"">{labelText} {requiredHtml}</label> <div class=""col-xs-{EditorColCount}""> <input id='{htmlId}' name='{htmlName}' type='text' class='form-control input-sm {CssClass}' {valHtml} /> {metaHtml} </div> {js}"); } } }
public void LoadDataFromXMLDocument(string filename) { Font font = null; Microsoft.Xna.Framework.Color color; XmlDocument xmlDocument = new XmlDocument(); var xml = Platform.Current.LoadText(filename); xmlDocument.LoadXml(xml); 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 = CacheManager.GetTempTexture(string.Concat(@"Content\Textures\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(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(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(font, color); labelText.Text.Position = rectangle; labelText.Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), xmlNodes1.Attributes.GetNamedItem("Align").Value); labelText.PropertyName = xmlNodes1.Attributes.GetNamedItem("PropertyName").Value; this.troopDetail.LabelTexts.Add(labelText); num = num + 2; } xmlNodes = nextSibling.ChildNodes.Item(4); this.troopDetail.OtherPersonClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.OtherPersonText.ClientWidth = this.troopDetail.OtherPersonClient.Width; this.troopDetail.OtherPersonText.ClientHeight = this.troopDetail.OtherPersonClient.Height; this.troopDetail.OtherPersonText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.OtherPersonText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.OtherPersonText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); //this.troopDetail.OtherPersonText.Builder.SetFreeTextBuilder(font); this.troopDetail.OtherPersonText.DefaultColor = color; xmlNodes = nextSibling.ChildNodes.Item(5); this.troopDetail.CombatMethodClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.CombatMethodText.ClientWidth = this.troopDetail.CombatMethodClient.Width; this.troopDetail.CombatMethodText.ClientHeight = this.troopDetail.CombatMethodClient.Height; this.troopDetail.CombatMethodText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.CombatMethodText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.CombatMethodText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); this.troopDetail.CombatMethodText.SubTitleColor2 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor2").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.CombatMethodText.Builder = font; //this.troopDetail.CombatMethodText.Builder.SetFreeTextBuilder(font); this.troopDetail.CombatMethodText.DefaultColor = color; xmlNodes = nextSibling.ChildNodes.Item(6); this.troopDetail.StuntClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.StuntText.ClientWidth = this.troopDetail.CombatMethodClient.Width; this.troopDetail.StuntText.ClientHeight = this.troopDetail.CombatMethodClient.Height; this.troopDetail.StuntText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.StuntText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.StuntText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); this.troopDetail.StuntText.SubTitleColor2 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor2").Value); this.troopDetail.StuntText.SubTitleColor3 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.StuntText.Builder = font; //this.troopDetail.StuntText.Builder.SetFreeTextBuilder(font); this.troopDetail.StuntText.DefaultColor = color; xmlNodes = nextSibling.ChildNodes.Item(7); this.troopDetail.InfluenceClient = StaticMethods.LoadRectangleFromXMLNode(xmlNodes); this.troopDetail.InfluenceText.ClientWidth = this.troopDetail.InfluenceClient.Width; this.troopDetail.InfluenceText.ClientHeight = this.troopDetail.InfluenceClient.Height; this.troopDetail.InfluenceText.RowMargin = int.Parse(xmlNodes.Attributes.GetNamedItem("RowMargin").Value); this.troopDetail.InfluenceText.TitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("TitleColor").Value); this.troopDetail.InfluenceText.SubTitleColor = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor").Value); this.troopDetail.InfluenceText.SubTitleColor2 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor2").Value); this.troopDetail.InfluenceText.SubTitleColor3 = StaticMethods.LoadColor(xmlNodes.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(xmlNodes, out font, out color); this.troopDetail.InfluenceText.Builder = font; //this.troopDetail.InfluenceText.Builder.SetFreeTextBuilder(font); this.troopDetail.InfluenceText.DefaultColor = color; }
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.transportDialog.BackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.transportDialog.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); node = nextSibling.ChildNodes.Item(1); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.TitleText = new FreeText(font, color); this.transportDialog.TitleText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.TitleText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(2); for (int i = 0; i < node.ChildNodes.Count; i += 2) { LabelText item = new LabelText(); XmlNode node3 = node.ChildNodes.Item(i); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Label = new FreeText(font, color); item.Label.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Label.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.Label.Text = node3.Attributes.GetNamedItem("Label").Value; node3 = node.ChildNodes.Item(i + 1); StaticMethods.LoadFontAndColorFromXMLNode(node3, out font, out color); item.Text = new FreeText(font, color); item.Text.Position = StaticMethods.LoadRectangleFromXMLNode(node3); item.Text.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node3.Attributes.GetNamedItem("Align").Value); item.PropertyName = node3.Attributes.GetNamedItem("PropertyName").Value; this.transportDialog.LabelTexts.Add(item); } node = nextSibling.ChildNodes.Item(3); this.transportDialog.DestinationButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.DestinationButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.DestinationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.DestinationButtonDisplayTexture = this.transportDialog.DestinationButtonTexture; node = nextSibling.ChildNodes.Item(4); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.DestinationText = new FreeText(font, color); this.transportDialog.DestinationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.DestinationText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(5); this.transportDialog.InputNumberButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.InputNumberButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.InputNumberButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.InputNumberButtonDisplayTexture = this.transportDialog.InputNumberButtonTexture; node = nextSibling.ChildNodes.Item(6); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.InputNumberText = new FreeText(font, color); this.transportDialog.InputNumberText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.InputNumberText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(7); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.DestinationCommentText = new FreeText(font, color); this.transportDialog.DestinationCommentText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.DestinationCommentText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(8); this.transportDialog.StartButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.StartButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.StartButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.transportDialog.StartButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.StartButtonDisplayTexture = this.transportDialog.StartButtonDisabledTexture; node = nextSibling.ChildNodes.Item(9); this.transportDialog.EmperorDestinationButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.EmperorDestinationButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.EmperorDestinationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorDestinationButtonDisplayTexture = this.transportDialog.EmperorDestinationButtonTexture; node = nextSibling.ChildNodes.Item(10); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.EmperorDestinationText = new FreeText(font, color); this.transportDialog.EmperorDestinationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorDestinationText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(11); this.transportDialog.EmperorInputNumberButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.EmperorInputNumberButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.EmperorInputNumberButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorInputNumberButtonDisplayTexture = this.transportDialog.EmperorInputNumberButtonTexture; node = nextSibling.ChildNodes.Item(12); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.EmperorInputNumberText = new FreeText(font, color); this.transportDialog.EmperorInputNumberText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorInputNumberText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(13); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.EmperorDestinationCommentText = new FreeText(font, color); this.transportDialog.EmperorDestinationCommentText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorDestinationCommentText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(14); this.transportDialog.EmperorStartButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.EmperorStartButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.EmperorStartButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.transportDialog.EmperorStartButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.EmperorStartButtonDisplayTexture = this.transportDialog.EmperorStartButtonDisabledTexture; node = nextSibling.ChildNodes.Item(15); this.transportDialog.FundDestinationButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.FundDestinationButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.FundDestinationButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundDestinationButtonDisplayTexture = this.transportDialog.FundDestinationButtonTexture; node = nextSibling.ChildNodes.Item(16); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.FundDestinationText = new FreeText(font, color); this.transportDialog.FundDestinationText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundDestinationText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(17); this.transportDialog.FundInputNumberButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.FundInputNumberButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.FundInputNumberButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundInputNumberButtonDisplayTexture = this.transportDialog.FundInputNumberButtonTexture; node = nextSibling.ChildNodes.Item(18); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.FundInputNumberText = new FreeText(font, color); this.transportDialog.FundInputNumberText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundInputNumberText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(19); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.transportDialog.FundDestinationCommentText = new FreeText(font, color); this.transportDialog.FundDestinationCommentText.Position = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundDestinationCommentText.Align = (TextAlign)Enum.Parse(typeof(TextAlign), node.Attributes.GetNamedItem("Align").Value); node = nextSibling.ChildNodes.Item(20); this.transportDialog.FundStartButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.transportDialog.FundStartButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.transportDialog.FundStartButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\TransportDialog\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.transportDialog.FundStartButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.transportDialog.FundStartButtonDisplayTexture = this.transportDialog.FundStartButtonDisabledTexture; }
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.createTroop.BackgroundSize.X = int.Parse(node.Attributes.GetNamedItem("Width").Value); this.createTroop.BackgroundSize.Y = int.Parse(node.Attributes.GetNamedItem("Height").Value); this.createTroop.BackgroundTexture = CacheManager.GetTempTexture(@"Content\Textures\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(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(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(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 = font; //.SetFreeTextBuilder(font); this.createTroop.OtherPersonText.DefaultColor = color; this.createTroop.OtherPersonText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.createTroop.OtherPersonText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); 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); this.createTroop.CombatMethodText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.createTroop.CombatMethodText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.createTroop.CombatMethodText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.CombatMethodText.Builder = font; //.SetFreeTextBuilder(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); this.createTroop.StuntText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.createTroop.StuntText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.createTroop.StuntText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); this.createTroop.StuntText.SubTitleColor3 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.StuntText.Builder = font; //.SetFreeTextBuilder(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); this.createTroop.InfluenceText.TitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("TitleColor").Value); this.createTroop.InfluenceText.SubTitleColor = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor").Value); this.createTroop.InfluenceText.SubTitleColor2 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor2").Value); this.createTroop.InfluenceText.SubTitleColor3 = StaticMethods.LoadColor(node.Attributes.GetNamedItem("SubTitleColor3").Value); StaticMethods.LoadFontAndColorFromXMLNode(node, out font, out color); this.createTroop.InfluenceText.Builder = font; //.SetFreeTextBuilder(font); this.createTroop.InfluenceText.DefaultColor = color; node = nextSibling.ChildNodes.Item(8); this.createTroop.MilitaryButtonTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.MilitaryButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.MilitaryButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\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 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.PersonButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.PersonButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\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 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.LeaderButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.LeaderButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\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 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.RationButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.RationButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\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 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.CreateButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.CreateButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\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 = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("FileName").Value); this.createTroop.zijinButtonSelectedTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Selected").Value); this.createTroop.zijinButtonDisabledTexture = CacheManager.GetTempTexture(@"Content\Textures\GameComponents\CreateTroop\Data\" + node.Attributes.GetNamedItem("Disabled").Value); this.createTroop.zijinButtonPosition = StaticMethods.LoadRectangleFromXMLNode(node); this.createTroop.zijinButtonDisplayTexture = this.createTroop.zijinButtonTexture; }
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("其他人物", Color.Yellow); this.OtherPersonText.AddNewLine(); int personCount = troop.PersonCount - 1; this.OtherPersonText.AddText(string.Concat(personCount.ToString(), "人"), Color.Lime); 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("部队战法", Color.Yellow); this.CombatMethodText.AddNewLine(); personCount = troop.CombatMethods.Count; this.CombatMethodText.AddText(string.Concat(personCount.ToString(), "种"), Color.Lime); 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, Color.Red); personCount = combatMethod.Combativity - troop.DecrementOfCombatMethodCombativityConsuming; this.CombatMethodText.AddText(string.Concat(" 战意消耗", personCount.ToString()), Color.LightGreen); this.CombatMethodText.AddNewLine(); } } finally { enumerator2.Dispose(); } this.CombatMethodText.ResortTexts(); this.StuntText.AddText("部队特技", Color.Yellow); this.StuntText.AddNewLine(); personCount = troop.Stunts.Count; this.StuntText.AddText(string.Concat(personCount.ToString(), "种"), Color.Lime); 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, Color.Red); personCount = stunt.Combativity; this.StuntText.AddText(string.Concat(" 战意消耗", personCount.ToString()), Color.LightGreen); this.StuntText.AddNewLine(); } } finally { enumerator3.Dispose(); } this.StuntText.ResortTexts(); this.InfluenceText.AddText("部队特性", Color.Yellow); this.InfluenceText.AddNewLine(); this.InfluenceText.AddText(this.ShowingTroop.Army.Kind.Name, Color.Lime); 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, Color.Red); this.InfluenceText.AddText(influence.Description, Color.LightGreen); this.InfluenceText.AddNewLine(); } } finally { enumerator4.Dispose(); } 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); }
protected void buttonValidar_Click(object sender, EventArgs e) { LabelText.ValidaCondicao(); }