2019-01-24 16:43:03 +08:00
|
|
|
|
// 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.
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
|
|
|
|
using System.ComponentModel;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using osu.Game.Rulesets;
|
|
|
|
|
using osu.Game.Rulesets.Mods;
|
|
|
|
|
using osu.Game.Screens.Play;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Tests.Visual
|
|
|
|
|
{
|
|
|
|
|
[Description("Player instantiated with a replay.")]
|
|
|
|
|
public class TestCaseReplay : TestCasePlayer
|
|
|
|
|
{
|
2018-06-06 19:21:47 +08:00
|
|
|
|
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
|
2018-06-06 19:21:47 +08:00
|
|
|
|
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
|
2018-06-06 19:21:47 +08:00
|
|
|
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Where(m => !(m is ModAutoplay));
|
2018-04-13 17:19:50 +08:00
|
|
|
|
|
2018-12-09 22:39:35 +08:00
|
|
|
|
return new ReplayPlayer(dummyRulesetContainer.ReplayScore);
|
2018-04-13 17:19:50 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|