Use TimeSpan instead of DateTime in RoundEnd and Comms Console.

This commit is contained in:
zumorica
2020-04-09 20:28:22 +02:00
parent 83e9688133
commit 3c795ad283
3 changed files with 12 additions and 6 deletions

View File

@@ -3,6 +3,8 @@ using Content.Client.Command;
using Content.Shared.GameObjects.Components.Command;
using Robust.Client.GameObjects.Components.UserInterface;
using Robust.Shared.GameObjects.Components.UserInterface;
using Robust.Shared.Interfaces.Timing;
using Robust.Shared.IoC;
using Robust.Shared.ViewVariables;
namespace Content.Client.GameObjects.Components.Command
@@ -12,11 +14,13 @@ namespace Content.Client.GameObjects.Components.Command
[ViewVariables]
private CommunicationsConsoleMenu _menu;
[Dependency] private IGameTiming _gameTiming;
public bool CountdownStarted { get; private set; }
public int Countdown => _expectedCountdownTime == null
? 0 : Math.Max((int)(_expectedCountdownTime.Value.Subtract(DateTime.Now)).TotalSeconds, 0);
private DateTime? _expectedCountdownTime;
? 0 : Math.Max((int)_expectedCountdownTime.Value.Subtract(_gameTiming.CurTime).TotalSeconds, 0);
private TimeSpan? _expectedCountdownTime;
public CommunicationsConsoleBoundUserInterface(ClientUserInterfaceComponent owner, object uiKey) : base(owner, uiKey)
{