Merge pull request #5517 from deniz1a/blink-ready
New alternating colors blink option for build palette widget
This commit is contained in:
@@ -33,6 +33,9 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
|
|
||||||
public class ProductionPaletteWidget : Widget
|
public class ProductionPaletteWidget : Widget
|
||||||
{
|
{
|
||||||
|
public enum ReadyTextStyleOptions { Solid, AlternatingColor, Blinking }
|
||||||
|
public readonly ReadyTextStyleOptions ReadyTextStyle = ReadyTextStyleOptions.AlternatingColor;
|
||||||
|
public readonly Color ReadyTextAltColor = Color.LimeGreen;
|
||||||
public readonly int Columns = 3;
|
public readonly int Columns = 3;
|
||||||
public readonly string TabClick = null;
|
public readonly string TabClick = null;
|
||||||
public readonly string DisabledTabClick = null;
|
public readonly string DisabledTabClick = null;
|
||||||
@@ -248,11 +251,14 @@ namespace OpenRA.Mods.Cnc.Widgets
|
|||||||
var waiting = first != CurrentQueue.CurrentItem() && !first.Done;
|
var waiting = first != CurrentQueue.CurrentItem() && !first.Done;
|
||||||
if (first.Done)
|
if (first.Done)
|
||||||
{
|
{
|
||||||
// Blink the ready text
|
if (ReadyTextStyle == ReadyTextStyleOptions.Solid || orderManager.LocalFrameNumber / 9 % 2 == 0)
|
||||||
if (orderManager.LocalFrameNumber / 9 % 2 == 0)
|
|
||||||
overlayFont.DrawTextWithContrast(ReadyText,
|
overlayFont.DrawTextWithContrast(ReadyText,
|
||||||
icon.Pos + readyOffset,
|
icon.Pos + readyOffset,
|
||||||
Color.White, Color.Black, 1);
|
Color.White, Color.Black, 1);
|
||||||
|
else if (ReadyTextStyle == ReadyTextStyleOptions.AlternatingColor)
|
||||||
|
overlayFont.DrawTextWithContrast(ReadyText,
|
||||||
|
icon.Pos + readyOffset,
|
||||||
|
ReadyTextAltColor, Color.Black, 1);
|
||||||
}
|
}
|
||||||
else if (first.Paused)
|
else if (first.Paused)
|
||||||
overlayFont.DrawTextWithContrast(HoldText,
|
overlayFont.DrawTextWithContrast(HoldText,
|
||||||
|
|||||||
@@ -24,6 +24,9 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
{
|
{
|
||||||
class BuildPaletteWidget : Widget
|
class BuildPaletteWidget : Widget
|
||||||
{
|
{
|
||||||
|
public enum ReadyTextStyleOptions { Solid, AlternatingColor, Blinking }
|
||||||
|
public readonly ReadyTextStyleOptions ReadyTextStyle = ReadyTextStyleOptions.AlternatingColor;
|
||||||
|
public readonly Color ReadyTextAltColor = Color.LimeGreen;
|
||||||
public int Columns = 3;
|
public int Columns = 3;
|
||||||
public int Rows = 5;
|
public int Rows = 5;
|
||||||
|
|
||||||
@@ -275,8 +278,12 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
foreach (var tb in textBits)
|
foreach (var tb in textBits)
|
||||||
{
|
{
|
||||||
var size = font.Measure(tb.Second);
|
var size = font.Measure(tb.Second);
|
||||||
font.DrawTextWithContrast(tb.Second, tb.First - new float2(size.X / 2, 0),
|
if (ReadyTextStyle == ReadyTextStyleOptions.Solid || orderManager.LocalFrameNumber / 9 % 2 == 0 || tb.Second != ReadyText)
|
||||||
Color.White, Color.Black, 1);
|
font.DrawTextWithContrast(tb.Second, tb.First - new float2(size.X / 2, 0),
|
||||||
|
Color.White, Color.Black, 1);
|
||||||
|
else if (ReadyTextStyle == ReadyTextStyleOptions.AlternatingColor)
|
||||||
|
font.DrawTextWithContrast(tb.Second, tb.First - new float2(size.X / 2, 0),
|
||||||
|
ReadyTextAltColor, Color.Black, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Tooltip
|
// Tooltip
|
||||||
@@ -305,7 +312,7 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
return HoldText;
|
return HoldText;
|
||||||
|
|
||||||
if (item.Done)
|
if (item.Done)
|
||||||
return orderManager.LocalFrameNumber / 9 % 2 == 0 ? ReadyText : "";
|
return ReadyText;
|
||||||
|
|
||||||
return WidgetUtils.FormatTime(item.RemainingTimeActual);
|
return WidgetUtils.FormatTime(item.RemainingTimeActual);
|
||||||
}
|
}
|
||||||
@@ -545,4 +552,4 @@ namespace OpenRA.Mods.RA.Widgets
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -382,6 +382,8 @@ Container@PLAYER_WIDGETS:
|
|||||||
Y: 287
|
Y: 287
|
||||||
TooltipContainer: TOOLTIP_CONTAINER
|
TooltipContainer: TOOLTIP_CONTAINER
|
||||||
ReadyText: Ready
|
ReadyText: Ready
|
||||||
|
ReadyTextStyle: AlternatingColor
|
||||||
|
ReadyTextAltColor: 50,205,50
|
||||||
HoldText: On Hold
|
HoldText: On Hold
|
||||||
|
|
||||||
Background@FMVPLAYER:
|
Background@FMVPLAYER:
|
||||||
|
|||||||
@@ -112,6 +112,8 @@ Container@PLAYER_WIDGETS:
|
|||||||
Width: 238
|
Width: 238
|
||||||
Height: 500
|
Height: 500
|
||||||
ReadyText: READY
|
ReadyText: READY
|
||||||
|
ReadyTextStyle: AlternatingColor
|
||||||
|
ReadyTextAltColor: 50,205,50
|
||||||
HoldText: ON HOLD
|
HoldText: ON HOLD
|
||||||
RequiresText: Requires {0}
|
RequiresText: Requires {0}
|
||||||
IconWidth: 60
|
IconWidth: 60
|
||||||
|
|||||||
@@ -110,6 +110,8 @@ Container@PLAYER_WIDGETS:
|
|||||||
Width: 250
|
Width: 250
|
||||||
Height: 500
|
Height: 500
|
||||||
ReadyText: READY
|
ReadyText: READY
|
||||||
|
ReadyTextStyle: AlternatingColor
|
||||||
|
ReadyTextAltColor: 50,205,50
|
||||||
HoldText: ON HOLD
|
HoldText: ON HOLD
|
||||||
RequiresText: Requires {0}
|
RequiresText: Requires {0}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user