1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-14 12:33:01 +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:
Bartłomiej Dach 2023-08-28 10:06:26 +02:00
parent 0af6cc1394
commit 80ec18d117
No known key found for this signature in database

View File

@ -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
{