2018-01-05 11:21:19 +00:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
2017-09-18 13:32:49 +00:00
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
2018-01-17 08:35:27 +00:00
|
|
|
|
using System.ComponentModel;
|
2017-09-18 13:32:49 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
using osu.Game.Rulesets;
|
2018-01-17 08:35:27 +00:00
|
|
|
|
using osu.Game.Rulesets.Mods;
|
2017-09-18 13:32:49 +00:00
|
|
|
|
using osu.Game.Screens.Play;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
|
{
|
2018-01-17 08:35:27 +00:00
|
|
|
|
[Description("Player instantiated with a replay.")]
|
2017-12-20 12:47:45 +00:00
|
|
|
|
public class TestCaseReplay : TestCasePlayer
|
2017-09-18 13:32:49 +00:00
|
|
|
|
{
|
|
|
|
|
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
|
|
|
|
|
{
|
2018-01-17 08:35:27 +00:00
|
|
|
|
// We create a dummy RulesetContainer just to get the replay - we don't want to use mods here
|
|
|
|
|
// to simulate setting a replay rather than having the replay already set for us
|
2017-09-18 13:32:49 +00:00
|
|
|
|
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
2018-01-17 08:35:27 +00:00
|
|
|
|
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(beatmap, false);
|
|
|
|
|
|
|
|
|
|
// We have the replay
|
|
|
|
|
var replay = dummyRulesetContainer.Replay;
|
|
|
|
|
|
|
|
|
|
// Reset the mods
|
|
|
|
|
beatmap.Mods.Value = beatmap.Mods.Value.Where(m => !(m is ModAutoplay));
|
|
|
|
|
|
|
|
|
|
return new ReplayPlayer(replay)
|
|
|
|
|
{
|
|
|
|
|
InitialBeatmap = beatmap
|
|
|
|
|
};
|
2017-09-18 13:32:49 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|