mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 22:19:30 +08:00
Move player specific stuff to derived PlaySongSelect.
This commit is contained in:
parent
fae6afa9e3
commit
c3a0549cdd
30
osu.Game/Screens/Select/PlaySongSelect.cs
Normal file
30
osu.Game/Screens/Select/PlaySongSelect.cs
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using osu.Framework.Screens;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
|
using osu.Game.Screens.Play;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Select
|
||||||
|
{
|
||||||
|
public class PlaySongSelect : SongSelect
|
||||||
|
{
|
||||||
|
private OsuScreen player;
|
||||||
|
|
||||||
|
protected override void OnResuming(Screen last)
|
||||||
|
{
|
||||||
|
player = null;
|
||||||
|
base.OnResuming(last);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void OnSelected(WorkingBeatmap beatmap)
|
||||||
|
{
|
||||||
|
if (player != null) return;
|
||||||
|
|
||||||
|
(player = new PlayerLoader(new Player
|
||||||
|
{
|
||||||
|
Beatmap = Beatmap, //eagerly set this so it's present before push.
|
||||||
|
})).LoadAsync(Game, l => Push(player));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -34,7 +34,7 @@ using osu.Game.Screens.Select.Options;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Select
|
namespace osu.Game.Screens.Select
|
||||||
{
|
{
|
||||||
public class SongSelect : OsuScreen
|
public abstract class SongSelect : OsuScreen
|
||||||
{
|
{
|
||||||
private Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
private Bindable<PlayMode> playMode = new Bindable<PlayMode>();
|
||||||
private BeatmapDatabase database;
|
private BeatmapDatabase database;
|
||||||
@ -60,8 +60,6 @@ namespace osu.Game.Screens.Select
|
|||||||
private BeatmapOptionsOverlay beatmapOptions;
|
private BeatmapOptionsOverlay beatmapOptions;
|
||||||
private Footer footer;
|
private Footer footer;
|
||||||
|
|
||||||
private OsuScreen player;
|
|
||||||
|
|
||||||
private FilterControl filter;
|
private FilterControl filter;
|
||||||
public FilterControl Filter
|
public FilterControl Filter
|
||||||
{
|
{
|
||||||
@ -158,15 +156,10 @@ namespace osu.Game.Screens.Select
|
|||||||
OnBack = Exit,
|
OnBack = Exit,
|
||||||
OnStart = () =>
|
OnStart = () =>
|
||||||
{
|
{
|
||||||
if (player != null || Beatmap == null)
|
if (Beatmap == null) return;
|
||||||
return;
|
|
||||||
|
|
||||||
Beatmap.PreferredPlayMode = playMode.Value;
|
Beatmap.PreferredPlayMode = playMode.Value;
|
||||||
|
OnSelected(Beatmap);
|
||||||
(player = new PlayerLoader(new Player
|
|
||||||
{
|
|
||||||
Beatmap = Beatmap, //eagerly set this so it's present before push.
|
|
||||||
})).LoadAsync(Game, l => Push(player));
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
@ -196,6 +189,8 @@ namespace osu.Game.Screens.Select
|
|||||||
Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
|
Task.Factory.StartNew(() => addBeatmapSets(game, initialAddSetsTask.Token), initialAddSetsTask.Token);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected abstract void OnSelected(WorkingBeatmap beatmap);
|
||||||
|
|
||||||
private ScheduledDelegate filterTask;
|
private ScheduledDelegate filterTask;
|
||||||
|
|
||||||
private void filterChanged(bool debounce = true, bool eagerSelection = true)
|
private void filterChanged(bool debounce = true, bool eagerSelection = true)
|
||||||
@ -268,8 +263,6 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
protected override void OnResuming(Screen last)
|
protected override void OnResuming(Screen last)
|
||||||
{
|
{
|
||||||
player = null;
|
|
||||||
|
|
||||||
changeBackground(Beatmap);
|
changeBackground(Beatmap);
|
||||||
ensurePlayingSelected();
|
ensurePlayingSelected();
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
|
@ -184,6 +184,7 @@
|
|||||||
<Compile Include="Modes\Ruleset.cs" />
|
<Compile Include="Modes\Ruleset.cs" />
|
||||||
<Compile Include="Screens\Ranking\Results.cs" />
|
<Compile Include="Screens\Ranking\Results.cs" />
|
||||||
<Compile Include="Screens\Direct\OnlineListing.cs" />
|
<Compile Include="Screens\Direct\OnlineListing.cs" />
|
||||||
|
<Compile Include="Screens\Select\PlaySongSelect.cs" />
|
||||||
<Compile Include="Screens\Select\SongSelect.cs" />
|
<Compile Include="Screens\Select\SongSelect.cs" />
|
||||||
<Compile Include="Modes\UI\HitRenderer.cs" />
|
<Compile Include="Modes\UI\HitRenderer.cs" />
|
||||||
<Compile Include="Modes\UI\Playfield.cs" />
|
<Compile Include="Modes\UI\Playfield.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user