mirror of
https://github.com/osukey/osukey.git
synced 2025-06-05 12:57:39 +09:00
Accept MasterGameplayClockContainer
rather than generic clock
This commit is contained in:
parent
51e607e834
commit
ec31f37ff7
@ -4,6 +4,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Timing;
|
using osu.Framework.Timing;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
||||||
{
|
{
|
||||||
@ -17,15 +18,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public const double CATCHUP_RATE = 2;
|
public const double CATCHUP_RATE = 2;
|
||||||
|
|
||||||
public readonly IFrameBasedClock Source;
|
private readonly GameplayClockContainer masterClock;
|
||||||
|
|
||||||
public double CurrentTime { get; private set; }
|
public double CurrentTime { get; private set; }
|
||||||
|
|
||||||
public bool IsRunning { get; private set; }
|
public bool IsRunning { get; private set; }
|
||||||
|
|
||||||
public CatchUpSpectatorPlayerClock(IFrameBasedClock source)
|
public CatchUpSpectatorPlayerClock(GameplayClockContainer masterClock)
|
||||||
{
|
{
|
||||||
Source = source;
|
this.masterClock = masterClock;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Reset() => CurrentTime = 0;
|
public void Reset() => CurrentTime = 0;
|
||||||
@ -69,16 +70,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer.Spectate
|
|||||||
ElapsedFrameTime = 0;
|
ElapsedFrameTime = 0;
|
||||||
FramesPerSecond = 0;
|
FramesPerSecond = 0;
|
||||||
|
|
||||||
Source.ProcessFrame();
|
masterClock.ProcessFrame();
|
||||||
|
|
||||||
if (IsRunning)
|
if (IsRunning)
|
||||||
{
|
{
|
||||||
double elapsedSource = Source.ElapsedFrameTime;
|
double elapsedSource = masterClock.ElapsedFrameTime;
|
||||||
double elapsed = elapsedSource * Rate;
|
double elapsed = elapsedSource * Rate;
|
||||||
|
|
||||||
CurrentTime += elapsed;
|
CurrentTime += elapsed;
|
||||||
ElapsedFrameTime = elapsed;
|
ElapsedFrameTime = elapsed;
|
||||||
FramesPerSecond = Source.FramesPerSecond;
|
FramesPerSecond = masterClock.FramesPerSecond;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user