mirror of
https://github.com/ppy/osu
synced 2025-01-08 23:29:43 +00:00
CreatePlayer shouldn't receive a beatmap
This commit is contained in:
parent
e77084bec4
commit
f2ac5b8b2d
@ -53,10 +53,10 @@ namespace osu.Game.Rulesets.Catch.Tests
|
|||||||
return beatmap;
|
return beatmap;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
||||||
return base.CreatePlayer(beatmap, ruleset);
|
return base.CreatePlayer(ruleset);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Scoring;
|
using osu.Game.Rulesets.Scoring;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -13,9 +12,9 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Description("Player instantiated with an autoplay mod.")]
|
[Description("Player instantiated with an autoplay mod.")]
|
||||||
public class TestCaseAutoplay : TestCasePlayer
|
public class TestCaseAutoplay : TestCasePlayer
|
||||||
{
|
{
|
||||||
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
||||||
return new ScoreAccessiblePlayer
|
return new ScoreAccessiblePlayer
|
||||||
{
|
{
|
||||||
AllowPause = false,
|
AllowPause = false,
|
||||||
|
@ -3,7 +3,6 @@
|
|||||||
|
|
||||||
using System.ComponentModel;
|
using System.ComponentModel;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Play;
|
using osu.Game.Screens.Play;
|
||||||
@ -13,18 +12,18 @@ namespace osu.Game.Tests.Visual
|
|||||||
[Description("Player instantiated with a replay.")]
|
[Description("Player instantiated with a replay.")]
|
||||||
public class TestCaseReplay : TestCasePlayer
|
public class TestCaseReplay : TestCasePlayer
|
||||||
{
|
{
|
||||||
protected override Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset)
|
protected override Player CreatePlayer(Ruleset ruleset)
|
||||||
{
|
{
|
||||||
// We create a dummy RulesetContainer just to get the replay - we don't want to use mods here
|
// 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
|
// to simulate setting a replay rather than having the replay already set for us
|
||||||
beatmap.Mods.Value = beatmap.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { ruleset.GetAutoplayMod() });
|
||||||
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(beatmap);
|
var dummyRulesetContainer = ruleset.CreateRulesetContainerWith(Beatmap.Value);
|
||||||
|
|
||||||
// We have the replay
|
// We have the replay
|
||||||
var replay = dummyRulesetContainer.Replay;
|
var replay = dummyRulesetContainer.Replay;
|
||||||
|
|
||||||
// Reset the mods
|
// Reset the mods
|
||||||
beatmap.Mods.Value = beatmap.Mods.Value.Where(m => !(m is ModAutoplay));
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Where(m => !(m is ModAutoplay));
|
||||||
|
|
||||||
return new ReplayPlayer(replay);
|
return new ReplayPlayer(replay);
|
||||||
}
|
}
|
||||||
|
@ -71,7 +71,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
if (Player != null)
|
if (Player != null)
|
||||||
Remove(Player);
|
Remove(Player);
|
||||||
|
|
||||||
var player = CreatePlayer(Beatmap, r);
|
var player = CreatePlayer(r);
|
||||||
|
|
||||||
LoadComponentAsync(player, LoadScreen);
|
LoadComponentAsync(player, LoadScreen);
|
||||||
|
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
Beatmap.Value.Track.Rate = Clock.Rate;
|
Beatmap.Value.Track.Rate = Clock.Rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected virtual Player CreatePlayer(WorkingBeatmap beatmap, Ruleset ruleset) => new Player
|
protected virtual Player CreatePlayer(Ruleset ruleset) => new Player
|
||||||
{
|
{
|
||||||
AllowPause = false,
|
AllowPause = false,
|
||||||
AllowLeadIn = false,
|
AllowLeadIn = false,
|
||||||
|
Loading…
Reference in New Issue
Block a user