1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-16 02:22:59 +08:00

Tidy up ProcessFrame and privatise const

This commit is contained in:
Dean Herbert 2022-08-24 15:37:14 +09:00
parent b564c34dbc
commit 2f5be6efca

View File

@ -16,7 +16,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
/// <summary> /// <summary>
/// The catch up rate. /// The catch up rate.
/// </summary> /// </summary>
public const double CATCHUP_RATE = 2; private const double catchup_rate = 2;
private readonly GameplayClockContainer masterClock; private readonly GameplayClockContainer masterClock;
@ -68,7 +68,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
{ {
} }
public double Rate => IsCatchingUp ? CATCHUP_RATE : 1; public double Rate => IsCatchingUp ? catchup_rate : 1;
double IAdjustableClock.Rate double IAdjustableClock.Rate
{ {
@ -76,13 +76,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
set => throw new NotSupportedException(); set => throw new NotSupportedException();
} }
double IClock.Rate => Rate;
public void ProcessFrame() public void ProcessFrame()
{ {
ElapsedFrameTime = 0;
FramesPerSecond = 0;
if (IsRunning) if (IsRunning)
{ {
double elapsedSource = masterClock.ElapsedFrameTime; double elapsedSource = masterClock.ElapsedFrameTime;
@ -92,6 +87,11 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
ElapsedFrameTime = elapsed; ElapsedFrameTime = elapsed;
FramesPerSecond = masterClock.FramesPerSecond; FramesPerSecond = masterClock.FramesPerSecond;
} }
else
{
ElapsedFrameTime = 0;
FramesPerSecond = 0;
}
} }
public double ElapsedFrameTime { get; private set; } public double ElapsedFrameTime { get; private set; }