Handle beatmapset removal in DownloadTrackingComposite

This commit is contained in:
Roman Kapustin 2019-02-13 22:11:46 +03:00
parent 99046f16e8
commit a289cb7c6a

View File

@ -51,6 +51,7 @@ namespace osu.Game.Overlays.Direct
};
beatmaps.ItemAdded += setAdded;
beatmaps.ItemRemoved += setRemoved;
}
#region Disposal
@ -120,12 +121,16 @@ namespace osu.Game.Overlays.Direct
Schedule(() => attachDownload(null));
}
private void setAdded(BeatmapSetInfo s, bool existing, bool silent)
private void setAdded(BeatmapSetInfo s, bool existing, bool silent) => setDownloadState(s, DownloadState.Downloaded);
private void setRemoved(BeatmapSetInfo s) => setDownloadState(s, DownloadState.NotDownloaded);
private void setDownloadState(BeatmapSetInfo s, DownloadState state)
{
if (s.OnlineBeatmapSetID != BeatmapSet.Value?.OnlineBeatmapSetID)
return;
Schedule(() => State.Value = DownloadState.LocallyAvailable);
Schedule(() => State.Value = state);
}
}
}