mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:17:26 +08:00
Set clock on video directly; ignore long frames
This commit is contained in:
parent
5fe764b2db
commit
380859e06e
@ -16,8 +16,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
private readonly VideoSprite video;
|
||||
|
||||
private ManualClock manualClock;
|
||||
private IFrameBasedClock sourceClock;
|
||||
private readonly ManualClock manualClock;
|
||||
|
||||
public TourneyVideo(Stream stream)
|
||||
{
|
||||
@ -34,6 +33,7 @@ namespace osu.Game.Tournament.Components
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
FillMode = FillMode.Fit,
|
||||
Clock = new FramedClock(manualClock = new ManualClock())
|
||||
};
|
||||
}
|
||||
|
||||
@ -46,21 +46,16 @@ namespace osu.Game.Tournament.Components
|
||||
}
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
|
||||
sourceClock = Clock;
|
||||
Clock = new FramedClock(manualClock = new ManualClock());
|
||||
}
|
||||
|
||||
protected override void Update()
|
||||
{
|
||||
base.Update();
|
||||
|
||||
if (manualClock != null && Clock.ElapsedFrameTime < 100)
|
||||
{
|
||||
// we want to avoid seeking as much as possible, because we care about performance, not sync.
|
||||
// to avoid seeking completely, we only increment out local clock when in an updating state.
|
||||
manualClock.CurrentTime += sourceClock.ElapsedFrameTime;
|
||||
manualClock.CurrentTime += Clock.ElapsedFrameTime;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user