mirror of
https://github.com/misternebula/quantum-space-buddies.git
synced 2025-01-27 12:35:28 +00:00
show timer when too far ahead
This commit is contained in:
parent
838dc8e3b2
commit
e6118c1530
@ -83,10 +83,6 @@ namespace QSB.TimeSync
|
||||
return;
|
||||
}
|
||||
|
||||
var totalSeconds = Mathf.Max(TargetTime - Time.timeSinceLevelLoad, 0f);
|
||||
var minutes = Mathf.FloorToInt(totalSeconds / 60f);
|
||||
var seconds = Mathf.FloorToInt(totalSeconds) % 60;
|
||||
var milliseconds = totalSeconds % 1 * 1000;
|
||||
var text = "";
|
||||
switch (_currentType)
|
||||
{
|
||||
@ -94,6 +90,10 @@ namespace QSB.TimeSync
|
||||
switch ((FastForwardReason)_currentReason)
|
||||
{
|
||||
case FastForwardReason.TooFarBehind:
|
||||
var totalSeconds = Mathf.Max(TargetTime - Time.timeSinceLevelLoad, 0f);
|
||||
var minutes = Mathf.FloorToInt(totalSeconds / 60f);
|
||||
var seconds = Mathf.FloorToInt(totalSeconds) % 60;
|
||||
var milliseconds = totalSeconds % 1 * 1000;
|
||||
text = $"{minutes:D2}:{seconds:D2}.{milliseconds:000}"
|
||||
+ Environment.NewLine
|
||||
+ "Fast-forwarding to match server time...";
|
||||
@ -110,7 +110,13 @@ namespace QSB.TimeSync
|
||||
break;
|
||||
|
||||
case PauseReason.TooFarAhead:
|
||||
text = "Pausing to match server time...";
|
||||
var totalSeconds = Mathf.Max(Time.timeSinceLevelLoad - TargetTime, 0f);
|
||||
var minutes = Mathf.FloorToInt(totalSeconds / 60f);
|
||||
var seconds = Mathf.FloorToInt(totalSeconds) % 60;
|
||||
var milliseconds = totalSeconds % 1 * 1000;
|
||||
text = $"{minutes:D2}:{seconds:D2}.{milliseconds:000}"
|
||||
+ Environment.NewLine
|
||||
+ "Pausing to match server time...";
|
||||
break;
|
||||
|
||||
case PauseReason.WaitingForAllPlayersToBeReady:
|
||||
|
@ -192,13 +192,14 @@ namespace QSB.TimeSync
|
||||
OWTime.SetMaxDeltaTime(0.033333335f);
|
||||
OWTime.SetFixedTimestep(0.033333335f);
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
TimeSyncUI.Start(TimeSyncType.FastForwarding, FastForwardReason.TooFarBehind);
|
||||
TimeSyncUI.Start(TimeSyncType.FastForwarding, reason);
|
||||
}
|
||||
|
||||
private void StartPausing(PauseReason reason)
|
||||
{
|
||||
if (CurrentState == State.Pausing)
|
||||
{
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -212,6 +213,7 @@ namespace QSB.TimeSync
|
||||
CurrentState = State.Pausing;
|
||||
CurrentReason = reason;
|
||||
SpinnerUI.Show();
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
TimeSyncUI.Start(TimeSyncType.Pausing, reason);
|
||||
}
|
||||
|
||||
@ -322,7 +324,7 @@ namespace QSB.TimeSync
|
||||
|
||||
// set fastforwarding timescale
|
||||
|
||||
if (CurrentState == State.FastForwarding)
|
||||
if (CurrentState == State.FastForwarding && (FastForwardReason)CurrentReason == FastForwardReason.TooFarBehind)
|
||||
{
|
||||
if (Locator.GetPlayerCamera() != null && !Locator.GetPlayerCamera().enabled)
|
||||
{
|
||||
@ -335,6 +337,11 @@ namespace QSB.TimeSync
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
}
|
||||
|
||||
if (CurrentState == State.Pausing && (PauseReason)CurrentReason == PauseReason.TooFarAhead)
|
||||
{
|
||||
TimeSyncUI.TargetTime = _serverTime;
|
||||
}
|
||||
|
||||
if (CurrentState != State.Loaded && CurrentState != State.NotLoaded && CurrentReason == null)
|
||||
{
|
||||
DebugLog.ToConsole($"Warning - CurrentReason is null.", MessageType.Warning);
|
||||
@ -428,4 +435,4 @@ namespace QSB.TimeSync
|
||||
OWTime.SetTimeScale(mappedTimescale);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user