diff --git a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs index f255403e81..d9eb827834 100644 --- a/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs +++ b/osu.Game/Overlays/Direct/DownloadTrackingComposite.cs @@ -11,6 +11,9 @@ using osu.Game.Online.API.Requests; namespace osu.Game.Overlays.Direct { + /// + /// A component which tracks a beatmap through potential download/import/deletion. + /// public abstract class DownloadTrackingComposite : CompositeDrawable { public readonly Bindable BeatmapSet = new Bindable(); @@ -51,6 +54,7 @@ namespace osu.Game.Overlays.Direct }; beatmaps.ItemAdded += setAdded; + beatmaps.ItemRemoved += setRemoved; } #region Disposal @@ -105,27 +109,22 @@ namespace osu.Game.Overlays.Direct } } - private void onRequestSuccess(string data) - { - Schedule(() => State.Value = DownloadState.Downloaded); - } + private void onRequestSuccess(string _) => Schedule(() => State.Value = DownloadState.Downloaded); - private void onRequestProgress(float progress) - { - Schedule(() => Progress.Value = progress); - } + private void onRequestProgress(float progress) => Schedule(() => Progress.Value = progress); - private void onRequestFailure(Exception e) - { - Schedule(() => attachDownload(null)); - } + private void onRequestFailure(Exception e) => Schedule(() => attachDownload(null)); - private void setAdded(BeatmapSetInfo s, bool existing, bool silent) + private void setAdded(BeatmapSetInfo s, bool existing, bool silent) => setDownloadStateFromManager(s, DownloadState.LocallyAvailable); + + private void setRemoved(BeatmapSetInfo s) => setDownloadStateFromManager(s, DownloadState.NotDownloaded); + + private void setDownloadStateFromManager(BeatmapSetInfo s, DownloadState state) => Schedule(() => { if (s.OnlineBeatmapSetID != BeatmapSet.Value?.OnlineBeatmapSetID) return; - Schedule(() => State.Value = DownloadState.LocallyAvailable); - } + State.Value = state; + }); } }