mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Disable frame accurate replay playback (#5316)
Disable frame accurate replay playback
This commit is contained in:
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using NUnit.Framework;
|
using NUnit.Framework;
|
||||||
using osu.Game.Replays;
|
using osu.Game.Replays;
|
||||||
@ -9,7 +10,7 @@ using osu.Game.Rulesets.Replays;
|
|||||||
namespace osu.Game.Tests.NonVisual
|
namespace osu.Game.Tests.NonVisual
|
||||||
{
|
{
|
||||||
[TestFixture]
|
[TestFixture]
|
||||||
public class FramedReplayinputHandlerTest
|
public class FramedReplayInputHandlerTest
|
||||||
{
|
{
|
||||||
private Replay replay;
|
private Replay replay;
|
||||||
private TestInputHandler handler;
|
private TestInputHandler handler;
|
||||||
@ -160,10 +161,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestRewindInsideImportantSection()
|
public void TestRewindInsideImportantSection()
|
||||||
{
|
{
|
||||||
// fast forward to important section
|
fastForwardToPoint(3000);
|
||||||
while (handler.SetFrameFromTime(3000) != null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
setTime(4000, 4000);
|
setTime(4000, 4000);
|
||||||
confirmCurrentFrame(4);
|
confirmCurrentFrame(4);
|
||||||
@ -205,10 +203,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
[Test]
|
[Test]
|
||||||
public void TestRewindOutOfImportantSection()
|
public void TestRewindOutOfImportantSection()
|
||||||
{
|
{
|
||||||
// fast forward to important section
|
fastForwardToPoint(3500);
|
||||||
while (handler.SetFrameFromTime(3500) != null)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
confirmCurrentFrame(3);
|
confirmCurrentFrame(3);
|
||||||
confirmNextFrame(4);
|
confirmNextFrame(4);
|
||||||
@ -227,6 +222,15 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
confirmNextFrame(2);
|
confirmNextFrame(2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void fastForwardToPoint(double destination)
|
||||||
|
{
|
||||||
|
for (int i = 0; i < 1000; i++)
|
||||||
|
if (handler.SetFrameFromTime(destination) == null)
|
||||||
|
return;
|
||||||
|
|
||||||
|
throw new TimeoutException("Seek was never fulfilled");
|
||||||
|
}
|
||||||
|
|
||||||
private void setTime(double set, double? expect)
|
private void setTime(double set, double? expect)
|
||||||
{
|
{
|
||||||
Assert.AreEqual(expect, handler.SetFrameFromTime(set));
|
Assert.AreEqual(expect, handler.SetFrameFromTime(set));
|
||||||
@ -274,6 +278,7 @@ namespace osu.Game.Tests.NonVisual
|
|||||||
public TestInputHandler(Replay replay)
|
public TestInputHandler(Replay replay)
|
||||||
: base(replay)
|
: base(replay)
|
||||||
{
|
{
|
||||||
|
FrameAccuratePlayback = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override double AllowedImportantTimeSpan => 1000;
|
protected override double AllowedImportantTimeSpan => 1000;
|
@ -84,7 +84,7 @@ namespace osu.Game.Rulesets.Replays
|
|||||||
/// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data.
|
/// When set, we will ensure frames executed by nested drawables are frame-accurate to replay data.
|
||||||
/// Disabling this can make replay playback smoother (useful for autoplay, currently).
|
/// Disabling this can make replay playback smoother (useful for autoplay, currently).
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool FrameAccuratePlayback = true;
|
public bool FrameAccuratePlayback = false;
|
||||||
|
|
||||||
protected bool HasFrames => Frames.Count > 0;
|
protected bool HasFrames => Frames.Count > 0;
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user