mirror of
https://github.com/ppy/osu.git
synced 2025-01-13 14:12:56 +08:00
Combine multiple similar invalidation logic into single event
This commit is contained in:
parent
41f5a6e292
commit
32cc3f9ef7
@ -168,7 +168,7 @@ namespace osu.Game.Screens.Select
|
||||
applyActiveCriteria(false);
|
||||
|
||||
if (loadedTestBeatmaps)
|
||||
signalBeatmapsLoaded();
|
||||
invalidateAfterChange(true);
|
||||
|
||||
// Restore selection
|
||||
if (selectedBeatmapBefore != null && newRoot.BeatmapSetsByID.TryGetValue(selectedBeatmapBefore.BeatmapSet!.ID, out var newSelectionCandidates))
|
||||
@ -298,7 +298,8 @@ namespace osu.Game.Screens.Select
|
||||
removeBeatmapSet(id);
|
||||
}
|
||||
|
||||
signalBeatmapsLoaded();
|
||||
invalidateAfterChange(!BeatmapSetsLoaded);
|
||||
BeatmapSetsLoaded = true;
|
||||
return;
|
||||
}
|
||||
|
||||
@ -393,12 +394,7 @@ namespace osu.Game.Screens.Select
|
||||
root.RemoveItem(set);
|
||||
}
|
||||
|
||||
itemsCache.Invalidate();
|
||||
|
||||
if (!Scroll.UserScrolling)
|
||||
ScrollToSelected(true);
|
||||
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
invalidateAfterChange(true);
|
||||
});
|
||||
|
||||
public void UpdateBeatmapSet(BeatmapSetInfo beatmapSet) => Schedule(() =>
|
||||
@ -465,12 +461,7 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
itemsCache.Invalidate();
|
||||
|
||||
if (!Scroll.UserScrolling)
|
||||
ScrollToSelected(true);
|
||||
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
invalidateAfterChange(true);
|
||||
});
|
||||
|
||||
/// <summary>
|
||||
@ -748,15 +739,15 @@ namespace osu.Game.Screens.Select
|
||||
}
|
||||
}
|
||||
|
||||
private void signalBeatmapsLoaded()
|
||||
private void invalidateAfterChange(bool invokeSetsChangedEvent)
|
||||
{
|
||||
if (!BeatmapSetsLoaded)
|
||||
{
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
BeatmapSetsLoaded = true;
|
||||
}
|
||||
|
||||
itemsCache.Invalidate();
|
||||
|
||||
if (!Scroll.UserScrolling)
|
||||
ScrollToSelected(true);
|
||||
|
||||
if (invokeSetsChangedEvent)
|
||||
BeatmapSetsChanged?.Invoke();
|
||||
}
|
||||
|
||||
private float? scrollTarget;
|
||||
|
Loading…
Reference in New Issue
Block a user