(04facf9b6) Gray out the text in disabled buttons if the button has no visible sprite (the buttons in the main menu for example looked the same when disabled)

This commit is contained in:
Joonas Rikkonen
2019-04-03 16:24:34 +03:00
parent 64bec6d3b9
commit fd0e394827
3 changed files with 27 additions and 5 deletions
@@ -20,6 +20,8 @@ namespace Barotrauma
public OnButtonDownHandler OnButtonDown;
public bool CanBeSelected = true;
private Color? defaultTextColor;
public override bool Enabled
{
@@ -30,8 +32,13 @@ namespace Barotrauma
set
{
if (value == enabled) return;
if (value == enabled) { return; }
enabled = value;
if (color.A == 0)
{
if (defaultTextColor == null) { defaultTextColor = TextBlock.TextColor; }
TextBlock.TextColor = enabled ? defaultTextColor.Value : defaultTextColor.Value * 0.5f;
}
frame.Color = enabled ? color : Color.Gray * 0.7f;
}
}