mirror of
https://github.com/ppy/osu.git
synced 2024-12-13 03:42:57 +08:00
Remove unnecessary invalidation handling flow
This commit is contained in:
parent
0698471627
commit
aab4dcefbd
@ -1,10 +1,6 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
#nullable disable
|
||||
|
||||
using System;
|
||||
|
||||
namespace osu.Game.Beatmaps
|
||||
{
|
||||
public interface IWorkingBeatmapCache
|
||||
@ -27,10 +23,5 @@ namespace osu.Game.Beatmaps
|
||||
/// </summary>
|
||||
/// <param name="beatmapInfo">The beatmap info to invalidate any cached entries for.</param>
|
||||
void Invalidate(BeatmapInfo beatmapInfo);
|
||||
|
||||
/// <summary>
|
||||
/// Fired whenever a <see cref="WorkingBeatmap"/> is invalidated.
|
||||
/// </summary>
|
||||
event Action<WorkingBeatmap> OnInvalidated;
|
||||
}
|
||||
}
|
||||
|
@ -296,24 +296,8 @@ namespace osu.Game.Screens.Select
|
||||
base.LoadComplete();
|
||||
|
||||
modSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(ModSelect);
|
||||
|
||||
beatmaps.OnInvalidated += workingBeatmapInvalidated;
|
||||
}
|
||||
|
||||
private void workingBeatmapInvalidated(WorkingBeatmap working) => Scheduler.AddOnce(w =>
|
||||
{
|
||||
// The global beatmap may have already been updated (ie. by the editor).
|
||||
// Only perform the actual switch if we still need to.
|
||||
if (w == Beatmap.Value)
|
||||
{
|
||||
// Not sure if this refresh is required.
|
||||
var beatmapInfo = beatmaps.QueryBeatmap(b => b.ID == w.BeatmapInfo.ID);
|
||||
Beatmap.Value = beatmaps.GetWorkingBeatmap(beatmapInfo);
|
||||
}
|
||||
|
||||
updateComponentFromBeatmap(Beatmap.Value);
|
||||
}, working);
|
||||
|
||||
/// <summary>
|
||||
/// Creates the buttons to be displayed in the footer.
|
||||
/// </summary>
|
||||
@ -719,8 +703,6 @@ namespace osu.Game.Screens.Select
|
||||
music.TrackChanged -= ensureTrackLooping;
|
||||
|
||||
modSelectOverlayRegistration?.Dispose();
|
||||
|
||||
beatmaps.OnInvalidated -= workingBeatmapInvalidated;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
Loading…
Reference in New Issue
Block a user