Show replay percentage as a tooltip.

This commit is contained in:
Paul Chote
2016-09-24 14:58:52 +01:00
parent 39f2949e09
commit 10b5d8a06b
6 changed files with 51 additions and 51 deletions

View File

@@ -62,14 +62,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
status.GetText = statusText;
}
var percentage = widget.GetOrNull<LabelWidget>("GAME_TIMER_PERCENTAGE");
if (percentage != null)
var timerTooltip = timer as LabelWithTooltipWidget;
if (timerTooltip != null)
{
var connection = orderManager.Connection as ReplayConnection;
if (connection != null && connection.TickCount != 0)
percentage.GetText = () => "({0}%)".F(orderManager.NetFrameNumber * 100 / connection.TickCount);
else if (timer != null)
timer.Bounds.Width += percentage.Bounds.Width;
timerTooltip.GetTooltipText = () => "{0}% complete".F(orderManager.NetFrameNumber * 100 / connection.TickCount);
else
timerTooltip.GetTooltipText = null;
}
}
}