Make game timer only blink on pause
This commit is contained in:
@@ -29,23 +29,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
Func<bool> shouldShowStatus = () => (world.Paused || world.ReplayTimestep != world.Timestep)
|
Func<bool> shouldShowStatus = () => (world.Paused || world.ReplayTimestep != world.Timestep)
|
||||||
&& (Ui.LastTickTime.Value - startTick) / 1000 % 2 == 0;
|
&& (Ui.LastTickTime.Value - startTick) / 1000 % 2 == 0;
|
||||||
|
|
||||||
Func<string> statusText = () =>
|
Func<bool> paused = () => world.Paused || world.ReplayTimestep == 0;
|
||||||
{
|
|
||||||
if (world.Paused || world.ReplayTimestep == 0)
|
|
||||||
return "Paused";
|
|
||||||
|
|
||||||
if (world.ReplayTimestep == 1)
|
|
||||||
return "Max Speed";
|
|
||||||
|
|
||||||
return $"{world.Timestep * 100 / world.ReplayTimestep}% Speed";
|
|
||||||
};
|
|
||||||
|
|
||||||
if (timer != null)
|
if (timer != null)
|
||||||
{
|
{
|
||||||
timer.GetText = () =>
|
timer.GetText = () =>
|
||||||
{
|
{
|
||||||
if (status == null && shouldShowStatus())
|
if (status == null && paused() && shouldShowStatus())
|
||||||
return statusText();
|
return "Paused";
|
||||||
|
|
||||||
var timeLimit = tlm?.TimeLimit ?? 0;
|
var timeLimit = tlm?.TimeLimit ?? 0;
|
||||||
var displayTick = timeLimit > 0 ? timeLimit - world.WorldTick : world.WorldTick;
|
var displayTick = timeLimit > 0 ? timeLimit - world.WorldTick : world.WorldTick;
|
||||||
@@ -57,7 +48,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic
|
|||||||
{
|
{
|
||||||
// Blink the status line
|
// Blink the status line
|
||||||
status.IsVisible = shouldShowStatus;
|
status.IsVisible = shouldShowStatus;
|
||||||
status.GetText = statusText;
|
status.GetText = () =>
|
||||||
|
{
|
||||||
|
if (paused())
|
||||||
|
return "Paused";
|
||||||
|
|
||||||
|
if (world.ReplayTimestep == 1)
|
||||||
|
return "Max Speed";
|
||||||
|
|
||||||
|
return $"{world.Timestep * 100 / world.ReplayTimestep}% Speed";
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (timer is LabelWithTooltipWidget timerTooltip)
|
if (timer is LabelWithTooltipWidget timerTooltip)
|
||||||
|
|||||||
Reference in New Issue
Block a user