1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 03:22:55 +08:00

Fix hitting down and enter at song select causing a hard-crash

Carousel was not aware of the disabled beatmap change state. Also it was being set too late (in an async load) so wasn't useful. It's now pre-emptively set in PlaySongSelect before loading Player.
This commit is contained in:
Dean Herbert 2017-07-20 11:50:31 +09:00
parent 8417e59de3
commit 15eb6954da
3 changed files with 9 additions and 1 deletions

View File

@ -25,6 +25,8 @@ namespace osu.Game.Screens.Select
{ {
public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap; public BeatmapInfo SelectedBeatmap => selectedPanel?.Beatmap;
public override bool HandleInput => AllowSelection;
public Action BeatmapsChanged; public Action BeatmapsChanged;
public IEnumerable<BeatmapSetInfo> Beatmaps public IEnumerable<BeatmapSetInfo> Beatmaps
@ -228,6 +230,8 @@ namespace osu.Game.Screens.Select
private ScheduledDelegate filterTask; private ScheduledDelegate filterTask;
public bool AllowSelection = true;
public void Filter(FilterCriteria newCriteria = null, bool debounce = true) public void Filter(FilterCriteria newCriteria = null, bool debounce = true)
{ {
if (newCriteria != null) if (newCriteria != null)

View File

@ -105,6 +105,7 @@ namespace osu.Game.Screens.Select
if (player != null) return; if (player != null) return;
Beatmap.Value.Track.Looping = false; Beatmap.Value.Track.Looping = false;
Beatmap.Disabled = true;
LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player)); LoadComponentAsync(player = new PlayerLoader(new Player()), l => Push(player));
} }

View File

@ -110,7 +110,7 @@ namespace osu.Game.Screens.Select
Origin = Anchor.CentreRight, Origin = Anchor.CentreRight,
SelectionChanged = carouselSelectionChanged, SelectionChanged = carouselSelectionChanged,
BeatmapsChanged = carouselBeatmapsLoaded, BeatmapsChanged = carouselBeatmapsLoaded,
StartRequested = carouselRaisedStart StartRequested = carouselRaisedStart,
}); });
Add(FilterControl = new FilterControl Add(FilterControl = new FilterControl
{ {
@ -185,6 +185,9 @@ namespace osu.Game.Screens.Select
carousel.Beatmaps = database.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending); carousel.Beatmaps = database.GetAllWithChildren<BeatmapSetInfo>(b => !b.DeletePending);
Beatmap.ValueChanged += beatmap_ValueChanged; Beatmap.ValueChanged += beatmap_ValueChanged;
Beatmap.DisabledChanged += disabled => carousel.AllowSelection = !disabled;
carousel.AllowSelection = !Beatmap.Disabled;
} }
private void carouselBeatmapsLoaded() private void carouselBeatmapsLoaded()