apply mod difficulty settings during song select

This commit is contained in:
unknown
2019-12-12 23:41:46 +08:00
parent 052d0f4039
commit ec5b506960
2 changed files with 128 additions and 18 deletions

View File

@ -8,6 +8,9 @@ using NUnit.Framework;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Game.Beatmaps;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Play.HUD;
using osu.Game.Screens.Select;
using osu.Game.Tests.Beatmaps;
using osuTK;
@ -20,8 +23,10 @@ namespace osu.Game.Tests.Visual.SongSelect
{
public override IReadOnlyList<Type> RequiredTypes => new[] { typeof(BeatmapDetails) };
private ModDisplay modDisplay;
[BackgroundDependencyLoader]
private void load(OsuGameBase game)
private void load(OsuGameBase game, RulesetStore rulesets)
{
BeatmapDetailArea detailsArea;
Add(detailsArea = new BeatmapDetailArea
@ -31,6 +36,16 @@ namespace osu.Game.Tests.Visual.SongSelect
Size = new Vector2(550f, 450f),
});
Add(modDisplay = new ModDisplay
{
Anchor = Anchor.TopRight,
Origin = Anchor.TopRight,
AutoSizeAxes = Axes.Both,
Position = new Vector2(0, 25),
});
modDisplay.Current.BindTo(Mods);
AddStep("all metrics", () => detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
{
BeatmapInfo =
@ -163,6 +178,58 @@ namespace osu.Game.Tests.Visual.SongSelect
}));
AddStep("null beatmap", () => detailsArea.Beatmap = null);
AddStep("with EZ mod", () =>
{
detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
{
BeatmapInfo =
{
Version = "Has Easy Mod",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has the easy mod enabled",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 3,
DrainRate = 3,
OverallDifficulty = 3,
ApproachRate = 3,
},
StarDifficulty = 1f,
}
});
Mods.Value = new[] { rulesets.AvailableRulesets.First().CreateInstance().GetAllMods().First(m => m is ModEasy) };
});
AddStep("with HR mod", () =>
{
detailsArea.Beatmap = new TestWorkingBeatmap(new Beatmap
{
BeatmapInfo =
{
Version = "Has Hard Rock Mod",
Metadata = new BeatmapMetadata
{
Source = "osu!lazer",
Tags = "this beatmap has the hard rock mod enabled",
},
BaseDifficulty = new BeatmapDifficulty
{
CircleSize = 3,
DrainRate = 3,
OverallDifficulty = 3,
ApproachRate = 3,
},
StarDifficulty = 1f,
}
});
Mods.Value = new[] { rulesets.AvailableRulesets.First().CreateInstance().GetAllMods().First(m => m is ModHardRock) };
});
}
}
}