mirror of
https://github.com/ppy/osu.git
synced 2025-01-12 21:52:55 +08:00
Revert most changes to PlayerTestScene
This commit is contained in:
parent
e64b2b1682
commit
13e16530a6
@ -4,16 +4,12 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System;
|
using System;
|
||||||
using System.Diagnostics;
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Development;
|
|
||||||
using osu.Framework.Extensions.IEnumerableExtensions;
|
using osu.Framework.Extensions.IEnumerableExtensions;
|
||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Beatmaps;
|
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Database;
|
|
||||||
using osu.Game.Rulesets;
|
using osu.Game.Rulesets;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
|
|
||||||
@ -26,15 +22,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
protected virtual bool HasCustomSteps => false;
|
protected virtual bool HasCustomSteps => false;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Import the beatmap to the database before starting gameplay. Handy for testing local score storage and the likes.
|
|
||||||
/// </summary>
|
|
||||||
/// <remarks>
|
|
||||||
/// Only works under headless operation currently due to realm isolation difficulties.
|
|
||||||
/// If this is ever needed to change, consideration needs to be given to the fact that BeatmapManager is attached to the global realm.
|
|
||||||
/// </remarks>
|
|
||||||
protected virtual bool ImportBeatmapToDatabase => false;
|
|
||||||
|
|
||||||
protected TestPlayer Player;
|
protected TestPlayer Player;
|
||||||
|
|
||||||
protected OsuConfigManager LocalConfig;
|
protected OsuConfigManager LocalConfig;
|
||||||
@ -70,9 +57,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
protected virtual bool Autoplay => false;
|
protected virtual bool Autoplay => false;
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private BeatmapManager beatmaps { get; set; }
|
|
||||||
|
|
||||||
protected void LoadPlayer()
|
protected void LoadPlayer()
|
||||||
{
|
{
|
||||||
var ruleset = CreatePlayerRuleset();
|
var ruleset = CreatePlayerRuleset();
|
||||||
@ -80,22 +64,6 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
|
var beatmap = CreateBeatmap(ruleset.RulesetInfo);
|
||||||
|
|
||||||
if (ImportBeatmapToDatabase)
|
|
||||||
{
|
|
||||||
Debug.Assert(DebugUtils.IsNUnitRunning, $@"Importing beatmaps in {nameof(PlayerTestScene)} requires headless environment.");
|
|
||||||
|
|
||||||
Debug.Assert(beatmap.BeatmapInfo.BeatmapSet != null);
|
|
||||||
|
|
||||||
var imported = beatmaps.Import(beatmap.BeatmapInfo.BeatmapSet);
|
|
||||||
|
|
||||||
Debug.Assert(imported != null);
|
|
||||||
|
|
||||||
beatmap.BeatmapInfo = null;
|
|
||||||
beatmap.Difficulty = null;
|
|
||||||
|
|
||||||
beatmap.BeatmapInfo = imported.Value.Detach().Beatmaps.First();
|
|
||||||
}
|
|
||||||
|
|
||||||
Beatmap.Value = CreateWorkingBeatmap(beatmap);
|
Beatmap.Value = CreateWorkingBeatmap(beatmap);
|
||||||
SelectedMods.Value = Array.Empty<Mod>();
|
SelectedMods.Value = Array.Empty<Mod>();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user