public override void Draw(GameTime gameTime) { DrawPanel(); if (missionBackgroundTexture != null) { PanelBackgroundImageDrawMode originalDrawMode = PanelBackgroundDrawMode; PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.CENTERED; DrawBackgroundTexture(missionBackgroundTexture, new Color(40, 40, 40, 255)); PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; // DrawBackgroundTexture(darkeningTexture, new Color(0, 0, 0, 200)); PanelBackgroundDrawMode = originalDrawMode; } if (!string.IsNullOrEmpty(Text)) { var windowRectangle = RenderRectangle(); DrawStringWithShadow(Text, FontIndex, new Vector2(TextXMargin, TextYPosition), TextColor); } if (DrawBorders) { DrawPanelBorders(); } DrawChildren(gameTime); }
public override void ParseAttributeFromINI(IniFile iniFile, string key, string value) { switch (key) { case "BorderColor": BorderColor = AssetLoader.GetColorFromString(value); return; case "DrawMode": if (value == "Tiled") { PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.TILED; } else { PanelBackgroundDrawMode = PanelBackgroundImageDrawMode.STRETCHED; } return; case "AlphaRate": AlphaRate = Conversions.FloatFromString(value, 0.01f); return; case "BackgroundTexture": BackgroundTexture = AssetLoader.LoadTexture(value); return; case "DrawBorders": DrawBorders = Conversions.BooleanFromString(value, true); return; case "Padding": string[] parts = value.Split(','); int left = Int32.Parse(parts[0]); int top = Int32.Parse(parts[1]); int right = Int32.Parse(parts[2]); int bottom = Int32.Parse(parts[3]); ClientRectangle = new Rectangle(X - left, Y - top, Width + left + right, Height + top + bottom); foreach (XNAControl child in Children) { child.ClientRectangle = new Rectangle(child.X + left, child.Y + top, child.Width, child.Height); } return; } base.ParseAttributeFromINI(iniFile, key, value); }