Merge pull request #1357 from EVAST9919/song_select_delete

Fix wrong beatmap selection in song-select when deleting selected beatmap
This commit is contained in:
Dean Herbert 2017-11-07 23:11:30 +09:00 committed by GitHub
commit 3761df249f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -186,13 +186,18 @@ namespace osu.Game.Screens.Select
public Action<BeatmapInfo> HideDifficultyRequested;
private void selectNullBeatmap()
{
selectedGroup = null;
selectedPanel = null;
SelectionChanged?.Invoke(null);
}
public void SelectNext(int direction = 1, bool skipDifficulties = true)
{
if (groups.All(g => g.State == BeatmapGroupState.Hidden))
{
selectedGroup = null;
selectedPanel = null;
SelectionChanged?.Invoke(null);
selectNullBeatmap();
return;
}
@ -383,6 +388,14 @@ namespace osu.Game.Screens.Select
if (group == null)
return;
if (selectedGroup == group)
{
if (getVisibleGroups().Count() == 1)
selectNullBeatmap();
else
SelectNext();
}
groups.Remove(group);
panels.Remove(group.Header);
foreach (var p in group.BeatmapPanels)
@ -391,9 +404,6 @@ namespace osu.Game.Screens.Select
scrollableContent.Remove(group.Header);
scrollableContent.RemoveRange(group.BeatmapPanels);
if (selectedGroup == group)
SelectNext();
computeYPositions();
}