Client LuaCsForBarotrauma
GUIFrame.cs
1 using Microsoft.Xna.Framework;
2 using Microsoft.Xna.Framework.Graphics;
3 using System.Linq;
4 
5 namespace Barotrauma
6 {
7  public class GUIFrame : GUIComponent
8  {
9  public float OutlineThickness { get; set; }
10 
11  public GUIFrame(RectTransform rectT, string style = "", Color? color = null) : base(style, rectT)
12  {
13  Enabled = true;
14  if (color.HasValue)
15  {
16  this.color = color.Value;
17  }
18  }
19 
20  protected override void Draw(SpriteBatch spriteBatch)
21  {
22  if (!Visible) return;
23 
24  Color currColor = GetColor(State);
25 
26  if (sprites == null || !sprites.Any(s => s.Value.Any())) GUI.DrawRectangle(spriteBatch, Rect, currColor * (currColor.A/255.0f), true);
27  base.Draw(spriteBatch);
28 
29  if (OutlineColor != Color.Transparent)
30  {
31  GUI.DrawRectangle(spriteBatch, Rect, OutlineColor, false, thickness: OutlineThickness);
32  }
33  }
34  }
35 }
virtual ComponentState State
virtual Color GetColor(ComponentState state)
Dictionary< ComponentState, List< UISprite > > sprites
virtual Color OutlineColor
virtual Rectangle Rect
GUIFrame(RectTransform rectT, string style="", Color? color=null)
Definition: GUIFrame.cs:11
float OutlineThickness
Definition: GUIFrame.cs:9
override void Draw(SpriteBatch spriteBatch)
Definition: GUIFrame.cs:20