make timesyncui count down

This commit is contained in:
Mister_Nebula 2020-12-19 19:06:13 +00:00
parent e1f94a862f
commit d7de691807
2 changed files with 5 additions and 1 deletions

View File

@ -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 = "";

View File

@ -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);
}