More UI tweaking

This commit is contained in:
Regalis
2017-04-20 20:56:28 +03:00
parent 499284dc91
commit 2cac176c87
10 changed files with 73 additions and 35 deletions
+8
View File
@@ -174,6 +174,14 @@ namespace Barotrauma
Enabled = true;
}
public override void ApplyStyle(GUIComponentStyle style)
{
base.ApplyStyle(style);
if (frame != null) frame.ApplyStyle(style);
if (textBlock != null) textBlock.ApplyStyle(style);
}
public override void Draw(SpriteBatch spriteBatch)
{
if (!Visible) return;
+5
View File
@@ -111,6 +111,11 @@ namespace Barotrauma
set;
}
public GUIComponentStyle Style
{
get { return style; }
}
public bool Visible
{
get;
+11 -5
View File
@@ -36,15 +36,21 @@ namespace Barotrauma
GUIComponentStyle componentStyle = null;
if (parent != null)
{
string parentStyleName = parent.GetType().Name.ToLowerInvariant();
GUIComponentStyle parentStyle = null;
if (!componentStyles.TryGetValue(parentStyleName, out parentStyle))
GUIComponentStyle parentStyle = parent.Style;
if (parent.Style == null)
{
DebugConsole.ThrowError("Couldn't find a GUI style \""+ parentStyleName + "\"");
return;
string parentStyleName = parent.GetType().Name.ToLowerInvariant();
if (!componentStyles.TryGetValue(parentStyleName, out parentStyle))
{
DebugConsole.ThrowError("Couldn't find a GUI style \""+ parentStyleName + "\"");
return;
}
}
string childStyleName = string.IsNullOrEmpty(styleName) ? targetComponent.GetType().Name : styleName;
parentStyle.ChildStyles.TryGetValue(childStyleName.ToLowerInvariant(), out componentStyle);
}
+1 -1
View File
@@ -78,7 +78,7 @@ namespace Barotrauma
GUI.Style.Apply(box, "GUITickBox");
text = new GUITextBlock(new Rectangle(rect.Right, rect.Y, 20, rect.Height), label, "", Alignment.TopLeft, Alignment.Left | Alignment.CenterY, this, false, font);
GUI.Style.Apply(text, "", this);
GUI.Style.Apply(text, "GUIButtonHorizontal", this);
this.rect = new Rectangle(box.Rect.X, box.Rect.Y, 240, rect.Height);