1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-06 07:42:55 +08:00

Simplify null check in ScoreDownloadTracker and remove unnecessary ID check

This commit is contained in:
Dean Herbert 2021-10-29 11:56:17 +09:00
parent 75a088d4f4
commit dc44734db2

View File

@ -31,16 +31,17 @@ namespace osu.Game.Online
[BackgroundDependencyLoader(true)]
private void load()
{
if (Manager == null)
return;
// Used to interact with manager classes that don't support interface types. Will eventually be replaced.
var scoreInfo = new ScoreInfo { OnlineScoreID = TrackedItem.OnlineScoreID };
if (TrackedItem.ID > 0 || Manager?.IsAvailableLocally(scoreInfo) == true)
if (Manager.IsAvailableLocally(scoreInfo))
UpdateState(DownloadState.LocallyAvailable);
else if (Manager != null)
else
attachDownload(Manager.GetExistingDownload(scoreInfo));
if (Manager != null)
{
managerDownloadBegan = Manager.DownloadBegan.GetBoundCopy();
managerDownloadBegan.BindValueChanged(downloadBegan);
managerDownloadFailed = Manager.DownloadFailed.GetBoundCopy();
@ -50,7 +51,6 @@ namespace osu.Game.Online
managerRemoved = Manager.ItemRemoved.GetBoundCopy();
managerRemoved.BindValueChanged(itemRemoved);
}
}
private void downloadBegan(ValueChangedEvent<WeakReference<ArchiveDownloadRequest<ScoreInfo>>> weakRequest)
{