1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 01:27:29 +08:00

Make Player abstract and introduce SoloPlayer

This commit is contained in:
Dean Herbert 2021-03-23 14:47:15 +09:00
parent 5267fb74c4
commit 6cb14e91c9
4 changed files with 14 additions and 5 deletions

View File

@ -58,7 +58,7 @@ namespace osu.Game.Tests.Visual.Navigation
public void TestPerformAtSongSelectFromPlayerLoader()
{
PushAndConfirm(() => new PlaySongSelect());
PushAndConfirm(() => new PlayerLoader(() => new Player()));
PushAndConfirm(() => new PlayerLoader(() => new SoloPlayer()));
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true, new[] { typeof(PlaySongSelect) }));
AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Navigation
public void TestPerformAtMenuFromPlayerLoader()
{
PushAndConfirm(() => new PlaySongSelect());
PushAndConfirm(() => new PlayerLoader(() => new Player()));
PushAndConfirm(() => new PlayerLoader(() => new SoloPlayer()));
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true));
AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is MainMenu);

View File

@ -39,7 +39,7 @@ namespace osu.Game.Screens.Play
{
[Cached]
[Cached(typeof(ISamplePlaybackDisabler))]
public class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler
public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisabler
{
/// <summary>
/// The delay upon completion of the beatmap before displaying the results screen.
@ -135,7 +135,7 @@ namespace osu.Game.Screens.Play
/// <summary>
/// Create a new player instance.
/// </summary>
public Player(PlayerConfiguration configuration = null)
protected Player(PlayerConfiguration configuration = null)
{
Configuration = configuration ?? new PlayerConfiguration();
}

View File

@ -0,0 +1,9 @@
// 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.
namespace osu.Game.Screens.Play
{
public class SoloPlayer : Player
{
}
}

View File

@ -106,7 +106,7 @@ namespace osu.Game.Screens.Select
SampleConfirm?.Play();
this.Push(player = new PlayerLoader(() => new Player()));
this.Push(player = new PlayerLoader(() => new SoloPlayer()));
return true;
}