From fd9758dcbf674bd5f714fb98c9b94800da550393 Mon Sep 17 00:00:00 2001 From: Gustas <37534529+Punsho@users.noreply.github.com> Date: Fri, 8 Jul 2022 12:26:20 +0300 Subject: [PATCH] Make game timer only blink on pause --- .../Widgets/Logic/Ingame/GameTimerLogic.cs | 26 +++++++++---------- 1 file changed, 13 insertions(+), 13 deletions(-) diff --git a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs index 0c4d2dc5e4..21ca6f4ac2 100644 --- a/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs +++ b/OpenRA.Mods.Common/Widgets/Logic/Ingame/GameTimerLogic.cs @@ -29,23 +29,14 @@ namespace OpenRA.Mods.Common.Widgets.Logic Func shouldShowStatus = () => (world.Paused || world.ReplayTimestep != world.Timestep) && (Ui.LastTickTime.Value - startTick) / 1000 % 2 == 0; - Func statusText = () => - { - if (world.Paused || world.ReplayTimestep == 0) - return "Paused"; - - if (world.ReplayTimestep == 1) - return "Max Speed"; - - return $"{world.Timestep * 100 / world.ReplayTimestep}% Speed"; - }; + Func paused = () => world.Paused || world.ReplayTimestep == 0; if (timer != null) { timer.GetText = () => { - if (status == null && shouldShowStatus()) - return statusText(); + if (status == null && paused() && shouldShowStatus()) + return "Paused"; var timeLimit = tlm?.TimeLimit ?? 0; var displayTick = timeLimit > 0 ? timeLimit - world.WorldTick : world.WorldTick; @@ -57,7 +48,16 @@ namespace OpenRA.Mods.Common.Widgets.Logic { // Blink the status line 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)