1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-20 21:52:57 +08:00

Make TestCasePlayer more usable

No results screen crash, no unnecessary leadin time.
This commit is contained in:
Dean Herbert 2017-12-26 14:00:58 +09:00
parent 07d753441d
commit 9fb958eadc
2 changed files with 11 additions and 2 deletions

View File

@ -46,6 +46,8 @@ namespace osu.Game.Screens.Play
public bool HasFailed { get; private set; }
public bool AllowPause { get; set; } = true;
public bool AllowLeadIn { get; set; } = true;
public bool AllowResults { get; set; } = true;
public int RestartCount;
@ -136,7 +138,10 @@ namespace osu.Game.Screens.Play
decoupledClock = new DecoupleableInterpolatingFramedClock { IsCoupled = false };
var firstObjectTime = RulesetContainer.Objects.First().StartTime;
decoupledClock.Seek(Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn)));
decoupledClock.Seek(AllowLeadIn
? Math.Min(0, firstObjectTime - Math.Max(beatmap.ControlPointInfo.TimingPointAt(firstObjectTime).BeatLength * 4, beatmap.BeatmapInfo.AudioLeadIn))
: firstObjectTime);
decoupledClock.ProcessFrame();
offsetClock = new FramedOffsetClock(decoupledClock);
@ -273,6 +278,8 @@ namespace osu.Game.Screens.Play
ValidForResume = false;
if (!AllowResults) return;
using (BeginDelayedSequence(1000))
{
onCompletionEvent = Schedule(delegate

View File

@ -91,7 +91,9 @@ namespace osu.Game.Tests.Visual
protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player
{
InitialBeatmap = beatmap,
AllowPause = false
AllowPause = false,
AllowLeadIn = false,
AllowResults = false,
};
private const string test_beatmap_data =