diff --git a/osu.Game/Overlays/Direct/DownloadButton.cs b/osu.Game/Overlays/Direct/DownloadButton.cs index b3372bf237..201a79f58a 100644 --- a/osu.Game/Overlays/Direct/DownloadButton.cs +++ b/osu.Game/Overlays/Direct/DownloadButton.cs @@ -76,9 +76,6 @@ namespace osu.Game.Overlays.Direct { this.colours = colours; - beatmaps.ItemAdded += (set, existing, silent) => updateState(BeatmapSet.Value); - beatmaps.ItemRemoved += set => updateState(BeatmapSet.Value); - button.Action = () => { switch (State.Value) @@ -97,12 +94,6 @@ namespace osu.Game.Overlays.Direct }; } - private void updateState(BeatmapSetInfo set) - { - if (set.OnlineBeatmapSetID == BeatmapSet.Value.OnlineBeatmapSetID) - UpdateState(BeatmapSet.Value); - } - private void updateState(DownloadState state) { switch (state) diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index eabc02d66e..f255403e81 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -34,7 +34,15 @@ namespace osu.Game.Overlays.Direct { this.beatmaps = beatmaps; - BeatmapSet.BindValueChanged(UpdateState, true); + BeatmapSet.BindValueChanged(set => + { + if (set == null) + attachDownload(null); + else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID).Any()) + State.Value = DownloadState.LocallyAvailable; + else + attachDownload(beatmaps.GetExistingDownload(set)); + }, true); beatmaps.BeatmapDownloadBegan += download => { @@ -45,16 +53,6 @@ namespace osu.Game.Overlays.Direct beatmaps.ItemAdded += setAdded; } - protected void UpdateState(BeatmapSetInfo set) - { - if (set == null) - attachDownload(null); - else if (this.beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any()) - State.Value = DownloadState.LocallyAvailable; - else - attachDownload(this.beatmaps.GetExistingDownload(set)); - } - #region Disposal protected override void Dispose(bool isDisposing)