GUIStyle logic changes: instead of having a predetermined GUIComponentStyle for each type of GUIComponent, any GUIComponent can use any style. The GUIComponent constructors take the name of the style as a parameter, and if no style is specified, the default style for the GUIComponent in question will be used.

This commit is contained in:
Regalis
2017-04-07 22:29:07 +03:00
parent 1fe6427c05
commit 3844dd9dac
54 changed files with 484 additions and 475 deletions

View File

@@ -125,18 +125,18 @@ namespace Barotrauma
get { return caretPos; }
}
public GUITextBlock(Rectangle rect, string text, GUIStyle style, GUIComponent parent, ScalableFont font)
public GUITextBlock(Rectangle rect, string text, string style, GUIComponent parent, ScalableFont font)
: this(rect, text, style, Alignment.TopLeft, Alignment.TopLeft, parent, false, font)
{
}
public GUITextBlock(Rectangle rect, string text, GUIStyle style, GUIComponent parent = null, bool wrap = false)
public GUITextBlock(Rectangle rect, string text, string style, GUIComponent parent = null, bool wrap = false)
: this(rect, text, style, Alignment.TopLeft, Alignment.TopLeft, parent, wrap)
{
}
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment textAlignment = Alignment.Left, string style = null, GUIComponent parent = null, bool wrap = false)
: this(rect, text,color, textColor, Alignment.TopLeft, textAlignment, style, parent, wrap)
{
}
@@ -156,15 +156,15 @@ namespace Barotrauma
}
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, GUIStyle style = null, GUIComponent parent = null, bool wrap = false)
public GUITextBlock(Rectangle rect, string text, Color? color, Color? textColor, Alignment alignment, Alignment textAlignment = Alignment.Left, string style = null, GUIComponent parent = null, bool wrap = false)
: this (rect, text, style, alignment, textAlignment, parent, wrap, null)
{
if (color != null) this.color = (Color)color;
if (textColor != null) this.textColor = (Color)textColor;
}
public GUITextBlock(Rectangle rect, string text, GUIStyle style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, ScalableFont font = null)
:base (style)
public GUITextBlock(Rectangle rect, string text, string style, Alignment alignment = Alignment.TopLeft, Alignment textAlignment = Alignment.TopLeft, GUIComponent parent = null, bool wrap = false, ScalableFont font = null)
: base(style)
{
this.Font = font == null ? GUI.Font : font;
@@ -278,7 +278,7 @@ namespace Barotrauma
Rectangle drawRect = rect;
if (offset != Vector2.Zero) drawRect.Location += offset.ToPoint();
if (currColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
//if (currColor.A * currColor.A > 0.0f) GUI.DrawRectangle(spriteBatch, rect, currColor * (currColor.A / 255.0f), true);
base.Draw(spriteBatch);