mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 09:27:29 +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.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
using System;
|
|
||||||
|
|
||||||
namespace osu.Game.Beatmaps
|
namespace osu.Game.Beatmaps
|
||||||
{
|
{
|
||||||
public interface IWorkingBeatmapCache
|
public interface IWorkingBeatmapCache
|
||||||
@ -27,10 +23,5 @@ namespace osu.Game.Beatmaps
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="beatmapInfo">The beatmap info to invalidate any cached entries for.</param>
|
/// <param name="beatmapInfo">The beatmap info to invalidate any cached entries for.</param>
|
||||||
void Invalidate(BeatmapInfo beatmapInfo);
|
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();
|
base.LoadComplete();
|
||||||
|
|
||||||
modSelectOverlayRegistration = OverlayManager?.RegisterBlockingOverlay(ModSelect);
|
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>
|
/// <summary>
|
||||||
/// Creates the buttons to be displayed in the footer.
|
/// Creates the buttons to be displayed in the footer.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -719,8 +703,6 @@ namespace osu.Game.Screens.Select
|
|||||||
music.TrackChanged -= ensureTrackLooping;
|
music.TrackChanged -= ensureTrackLooping;
|
||||||
|
|
||||||
modSelectOverlayRegistration?.Dispose();
|
modSelectOverlayRegistration?.Dispose();
|
||||||
|
|
||||||
beatmaps.OnInvalidated -= workingBeatmapInvalidated;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
Loading…
Reference in New Issue
Block a user