diff --git a/osu.Game/Online/DownloadTrackingComposite.cs b/osu.Game/Online/DownloadTrackingComposite.cs
index 4e52761813..9dd8258e78 100644
--- a/osu.Game/Online/DownloadTrackingComposite.cs
+++ b/osu.Game/Online/DownloadTrackingComposite.cs
@@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
+using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Bindables;
using osu.Framework.Graphics.Containers;
@@ -65,6 +66,15 @@ namespace osu.Game.Online
managerRemoved.BindValueChanged(itemRemoved);
}
+ ///
+ /// Verifies that the given databased model is in a correct state to be considered available.
+ ///
+ ///
+ /// In the case of multiplayer/playlists, this has to verify that the databased beatmap set with the selected beatmap matches what's online.
+ ///
+ /// The model in database.
+ protected virtual bool VerifyDatabasedModel([NotNull] TModel databasedModel) => true;
+
private void downloadBegan(ValueChangedEvent>> weakRequest)
{
if (weakRequest.NewValue.TryGetTarget(out var request))
@@ -134,23 +144,35 @@ namespace osu.Game.Online
private void itemUpdated(ValueChangedEvent> weakItem)
{
if (weakItem.NewValue.TryGetTarget(out var item))
- setDownloadStateFromManager(item, DownloadState.LocallyAvailable);
+ {
+ Schedule(() =>
+ {
+ if (!item.Equals(Model.Value))
+ return;
+
+ if (!VerifyDatabasedModel(item))
+ {
+ State.Value = DownloadState.NotDownloaded;
+ return;
+ }
+
+ State.Value = DownloadState.LocallyAvailable;
+ });
+ }
}
private void itemRemoved(ValueChangedEvent> weakItem)
{
if (weakItem.NewValue.TryGetTarget(out var item))
- setDownloadStateFromManager(item, DownloadState.NotDownloaded);
+ {
+ Schedule(() =>
+ {
+ if (item.Equals(Model.Value))
+ State.Value = DownloadState.NotDownloaded;
+ });
+ }
}
- private void setDownloadStateFromManager(TModel s, DownloadState state) => Schedule(() =>
- {
- if (!s.Equals(Model.Value))
- return;
-
- State.Value = state;
- });
-
#region Disposal
protected override void Dispose(bool isDisposing)