Allow mods to override production widgets text colors.
This commit is contained in:
committed by
Matthias Mailänder
parent
b3d468aca1
commit
fceab4f388
@@ -41,6 +41,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
{
|
{
|
||||||
public enum ReadyTextStyleOptions { Solid, AlternatingColor, Blinking }
|
public enum ReadyTextStyleOptions { Solid, AlternatingColor, Blinking }
|
||||||
public readonly ReadyTextStyleOptions ReadyTextStyle = ReadyTextStyleOptions.AlternatingColor;
|
public readonly ReadyTextStyleOptions ReadyTextStyle = ReadyTextStyleOptions.AlternatingColor;
|
||||||
|
public readonly Color TextColor = Color.White;
|
||||||
public readonly Color ReadyTextAltColor = Color.Gold;
|
public readonly Color ReadyTextAltColor = Color.Gold;
|
||||||
public readonly int Columns = 3;
|
public readonly int Columns = 3;
|
||||||
public readonly int2 IconSize = new int2(64, 48);
|
public readonly int2 IconSize = new int2(64, 48);
|
||||||
@@ -559,27 +560,27 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
if (first.Done)
|
if (first.Done)
|
||||||
{
|
{
|
||||||
if (ReadyTextStyle == ReadyTextStyleOptions.Solid || orderManager.LocalFrameNumber * worldRenderer.World.Timestep / 360 % 2 == 0)
|
if (ReadyTextStyle == ReadyTextStyleOptions.Solid || orderManager.LocalFrameNumber * worldRenderer.World.Timestep / 360 % 2 == 0)
|
||||||
overlayFont.DrawTextWithContrast(ReadyText, icon.Pos + readyOffset, Color.White, Color.Black, 1);
|
overlayFont.DrawTextWithContrast(ReadyText, icon.Pos + readyOffset, TextColor, Color.Black, 1);
|
||||||
else if (ReadyTextStyle == ReadyTextStyleOptions.AlternatingColor)
|
else if (ReadyTextStyle == ReadyTextStyleOptions.AlternatingColor)
|
||||||
overlayFont.DrawTextWithContrast(ReadyText, icon.Pos + readyOffset, ReadyTextAltColor, Color.Black, 1);
|
overlayFont.DrawTextWithContrast(ReadyText, icon.Pos + readyOffset, ReadyTextAltColor, Color.Black, 1);
|
||||||
}
|
}
|
||||||
else if (first.Paused)
|
else if (first.Paused)
|
||||||
overlayFont.DrawTextWithContrast(HoldText,
|
overlayFont.DrawTextWithContrast(HoldText,
|
||||||
icon.Pos + holdOffset,
|
icon.Pos + holdOffset,
|
||||||
Color.White, Color.Black, 1);
|
TextColor, Color.Black, 1);
|
||||||
else if (!waiting && DrawTime)
|
else if (!waiting && DrawTime)
|
||||||
overlayFont.DrawTextWithContrast(WidgetUtils.FormatTime(first.Queue.RemainingTimeActual(first), World.Timestep),
|
overlayFont.DrawTextWithContrast(WidgetUtils.FormatTime(first.Queue.RemainingTimeActual(first), World.Timestep),
|
||||||
icon.Pos + timeOffset,
|
icon.Pos + timeOffset,
|
||||||
Color.White, Color.Black, 1);
|
TextColor, Color.Black, 1);
|
||||||
|
|
||||||
if (first.Infinite && symbolFont != null)
|
if (first.Infinite && symbolFont != null)
|
||||||
symbolFont.DrawTextWithContrast(InfiniteSymbol,
|
symbolFont.DrawTextWithContrast(InfiniteSymbol,
|
||||||
icon.Pos + infiniteOffset,
|
icon.Pos + infiniteOffset,
|
||||||
Color.White, Color.Black, 1);
|
TextColor, Color.Black, 1);
|
||||||
else if (total > 1 || waiting)
|
else if (total > 1 || waiting)
|
||||||
overlayFont.DrawTextWithContrast(total.ToString(),
|
overlayFont.DrawTextWithContrast(total.ToString(),
|
||||||
icon.Pos + queuedOffset,
|
icon.Pos + queuedOffset,
|
||||||
Color.White, Color.Black, 1);
|
TextColor, Color.Black, 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -91,6 +91,9 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite> getLeftArrowImage;
|
CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite> getLeftArrowImage;
|
||||||
CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite> getRightArrowImage;
|
CachedTransform<(bool Disabled, bool Pressed, bool Hover, bool Focused, bool Highlighted), Sprite> getRightArrowImage;
|
||||||
|
|
||||||
|
public readonly Color TabColor = Color.White;
|
||||||
|
public readonly Color TabColorDone = Color.Gold;
|
||||||
|
|
||||||
int contentWidth = 0;
|
int contentWidth = 0;
|
||||||
float listOffset = 0;
|
float listOffset = 0;
|
||||||
bool leftPressed = false;
|
bool leftPressed = false;
|
||||||
@@ -218,7 +221,7 @@ namespace OpenRA.Mods.Common.Widgets
|
|||||||
|
|
||||||
var textSize = font.Measure(tab.Name);
|
var textSize = font.Measure(tab.Name);
|
||||||
var position = new int2(rect.X + (rect.Width - textSize.X) / 2, rect.Y + (rect.Height - textSize.Y) / 2);
|
var position = new int2(rect.X + (rect.Width - textSize.X) / 2, rect.Y + (rect.Height - textSize.Y) / 2);
|
||||||
font.DrawTextWithContrast(tab.Name, position, tab.Queue.AllQueued().Any(i => i.Done) ? Color.Gold : Color.White, Color.Black, 1);
|
font.DrawTextWithContrast(tab.Name, position, tab.Queue.AllQueued().Any(i => i.Done) ? TabColorDone : TabColor, Color.Black, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
Game.Renderer.DisableScissor();
|
Game.Renderer.DisableScissor();
|
||||||
|
|||||||
Reference in New Issue
Block a user