mirror of
https://github.com/ppy/osu.git
synced 2026-05-19 12:00:05 +08:00
Reduce complexity of selection restore
This commit is contained in:
@@ -134,8 +134,7 @@ namespace osu.Game.Screens.Select
|
||||
if (selectedBeatmapSet != null && !originalBeatmapSetsDetached.Contains(selectedBeatmapSet.BeatmapSet))
|
||||
selectedBeatmapSet = null;
|
||||
|
||||
var selectedSetBefore = selectedBeatmapSet;
|
||||
var selectedBeatmapBefore = selectedBeatmap;
|
||||
var selectedBeatmapBefore = selectedBeatmap?.BeatmapInfo;
|
||||
|
||||
CarouselRoot newRoot = new CarouselRoot(this);
|
||||
|
||||
@@ -170,9 +169,9 @@ namespace osu.Game.Screens.Select
|
||||
signalBeatmapsLoaded();
|
||||
|
||||
// Restore selection
|
||||
if (selectedBeatmapBefore != null && selectedSetBefore != null && newRoot.BeatmapSetsByID.TryGetValue(selectedSetBefore.BeatmapSet.ID, out var newSelectionCandidates))
|
||||
if (selectedBeatmapBefore != null && newRoot.BeatmapSetsByID.TryGetValue(selectedBeatmapBefore.BeatmapSet!.ID, out var newSelectionCandidates))
|
||||
{
|
||||
CarouselBeatmap? found = newSelectionCandidates.SelectMany(s => s.Beatmaps).SingleOrDefault(b => b.BeatmapInfo.ID == selectedBeatmapBefore.BeatmapInfo.ID);
|
||||
CarouselBeatmap? found = newSelectionCandidates.SelectMany(s => s.Beatmaps).SingleOrDefault(b => b.BeatmapInfo.ID == selectedBeatmapBefore.ID);
|
||||
|
||||
if (found != null)
|
||||
found.State.Value = CarouselItemState.Selected;
|
||||
|
||||
Reference in New Issue
Block a user