From d7de691807ae295bcfa760da0364352bd1393894 Mon Sep 17 00:00:00 2001 From: Mister_Nebula <41904486+misternebula@users.noreply.github.com> Date: Sat, 19 Dec 2020 19:06:13 +0000 Subject: [PATCH] make timesyncui count down --- QSB/TimeSync/TimeSyncUI.cs | 4 +++- QSB/TimeSync/WakeUpSync.cs | 2 ++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/QSB/TimeSync/TimeSyncUI.cs b/QSB/TimeSync/TimeSyncUI.cs index c85b0ae0..548fbed0 100644 --- a/QSB/TimeSync/TimeSyncUI.cs +++ b/QSB/TimeSync/TimeSyncUI.cs @@ -9,6 +9,8 @@ namespace QSB.TimeSync { public static TimeSyncUI Instance; + public static float TargetTime; + private Canvas _canvas; private Text _text; private float _startTime; @@ -70,7 +72,7 @@ namespace QSB.TimeSync { return; } - var totalSeconds = Mathf.Max(Time.timeSinceLevelLoad - _startTime, 0f); + var totalSeconds = Mathf.Max(TargetTime - Time.timeSinceLevelLoad, 0f); var minutes = Mathf.FloorToInt(totalSeconds / 60f); var seconds = Mathf.FloorToInt(totalSeconds) % 60; var text = ""; diff --git a/QSB/TimeSync/WakeUpSync.cs b/QSB/TimeSync/WakeUpSync.cs index f0b60033..cfbe8b69 100644 --- a/QSB/TimeSync/WakeUpSync.cs +++ b/QSB/TimeSync/WakeUpSync.cs @@ -126,10 +126,12 @@ namespace QSB.TimeSync { if (_state == State.FastForwarding) { + TimeSyncUI.TargetTime = _serverTime; return; } _timeScale = MaxFastForwardSpeed; _state = State.FastForwarding; + TimeSyncUI.TargetTime = _serverTime; TimeSyncUI.Start(TimeSyncType.Fastforwarding); }