1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 06:52:56 +08:00
osu-lazer/osu.Game.Tests/Visual/TestCaseReplay.cs

30 lines
1.1 KiB
C#
Raw Normal View History

2018-04-13 17:19:50 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.ComponentModel;
using System.Linq;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
2018-11-29 12:22:45 +08:00
using osu.Game.Scoring;
2018-04-13 17:19:50 +08:00
using osu.Game.Screens.Play;
namespace osu.Game.Tests.Visual
{
[Description("Player instantiated with a replay.")]
public class TestCaseReplay : TestCasePlayer
{
protected override Player CreatePlayer(Ruleset ruleset)
2018-04-13 17:19:50 +08: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
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(Beatmap.Value);
2018-04-13 17:19:50 +08:00
// Reset the mods
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Where(m => !(m is ModAutoplay));
2018-04-13 17:19:50 +08:00
2018-11-29 12:22:45 +08:00
return new ReplayPlayer(new Score { Replay = dummyRulesetContainer.Replay });
2018-04-13 17:19:50 +08:00
}
}
}