mirror of
https://github.com/ppy/osu.git
synced 2026-05-18 23:50:42 +08:00
Fix incorrect selection restore code in split case
The fallback to "any of the added sets" needs to be applied after they've all been added, rather than with every added one. Otherwise, in flows that expect a particular difficulty to be selected in the end (such as exiting from editor) would end up switching away from the edited beatmap.
This commit is contained in:
@@ -419,6 +419,8 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (beatmapsSplitOut)
|
||||
{
|
||||
var newSets = new List<CarouselBeatmapSet>();
|
||||
|
||||
foreach (var beatmap in beatmapSet.Beatmaps)
|
||||
{
|
||||
var newSet = createCarouselSet(new BeatmapSetInfo(new[] { beatmap })
|
||||
@@ -429,13 +431,18 @@ namespace osu.Game.Screens.Select
|
||||
|
||||
if (newSet != null)
|
||||
{
|
||||
newSets.Add(newSet);
|
||||
root.AddItem(newSet);
|
||||
|
||||
// check if we can/need to maintain our current selection.
|
||||
if (previouslySelectedID != null)
|
||||
select((CarouselItem?)newSet.Beatmaps.FirstOrDefault(b => b.BeatmapInfo.ID == previouslySelectedID) ?? newSet);
|
||||
}
|
||||
}
|
||||
|
||||
// check if we can/need to maintain our current selection.
|
||||
if (previouslySelectedID != null)
|
||||
{
|
||||
var toSelect = newSets.FirstOrDefault(s => s.Beatmaps.Any(b => b.BeatmapInfo.ID == previouslySelectedID))
|
||||
?? newSets.FirstOrDefault();
|
||||
select(toSelect);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user