1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 20:25:39 +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() public void TestPerformAtSongSelectFromPlayerLoader()
{ {
PushAndConfirm(() => new PlaySongSelect()); PushAndConfirm(() => new PlaySongSelect());
PushAndConfirm(() => new PlayerLoader(() => new Player())); PushAndConfirm(() => new PlayerLoader(() => new SoloPlayer()));
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true, new[] { typeof(PlaySongSelect) })); AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true, new[] { typeof(PlaySongSelect) }));
AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect); AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is PlaySongSelect);
@ -69,7 +69,7 @@ namespace osu.Game.Tests.Visual.Navigation
public void TestPerformAtMenuFromPlayerLoader() public void TestPerformAtMenuFromPlayerLoader()
{ {
PushAndConfirm(() => new PlaySongSelect()); PushAndConfirm(() => new PlaySongSelect());
PushAndConfirm(() => new PlayerLoader(() => new Player())); PushAndConfirm(() => new PlayerLoader(() => new SoloPlayer()));
AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true)); AddStep("try to perform", () => Game.PerformFromScreen(_ => actionPerformed = true));
AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is MainMenu); AddUntilStep("returned to song select", () => Game.ScreenStack.CurrentScreen is MainMenu);

View File

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