1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 19:42:55 +08:00

Revert most changes to PlayerTestScene

This commit is contained in:
Dean Herbert 2022-07-08 18:44:50 +09:00
parent e64b2b1682
commit 13e16530a6

View File

@ -4,16 +4,12 @@
#nullable disable
using System;
using System.Diagnostics;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Development;
using osu.Framework.Extensions.IEnumerableExtensions;
using osu.Framework.Testing;
using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Database;
using osu.Game.Rulesets;
using osu.Game.Rulesets.Mods;
@ -26,15 +22,6 @@ namespace osu.Game.Tests.Visual
/// </summary>
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 OsuConfigManager LocalConfig;
@ -70,9 +57,6 @@ namespace osu.Game.Tests.Visual
protected virtual bool Autoplay => false;
[Resolved]
private BeatmapManager beatmaps { get; set; }
protected void LoadPlayer()
{
var ruleset = CreatePlayerRuleset();
@ -80,22 +64,6 @@ namespace osu.Game.Tests.Visual
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);
SelectedMods.Value = Array.Empty<Mod>();