mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 12:57:36 +08:00
Replace download tracker with local querying
This commit is contained in:
parent
254d22de1c
commit
7e80a71020
@ -5,12 +5,11 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using JetBrains.Annotations;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Extensions.ObjectExtensions;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Colour;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
@ -95,12 +94,12 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
private PanelBackground panelBackground;
|
||||
private FillFlowContainer mainFillFlow;
|
||||
|
||||
[CanBeNull]
|
||||
private BeatmapDownloadTracker downloadTracker;
|
||||
|
||||
[Resolved]
|
||||
private RulesetStore rulesets { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private BeatmapManager beatmaps { get; set; }
|
||||
|
||||
[Resolved]
|
||||
private OsuColour colours { get; set; }
|
||||
|
||||
@ -321,15 +320,6 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
difficultyIconContainer.FadeInFromZero(500, Easing.OutQuint);
|
||||
mainFillFlow.FadeInFromZero(500, Easing.OutQuint);
|
||||
|
||||
downloadTracker?.RemoveAndDisposeImmediately();
|
||||
|
||||
if (beatmap != null)
|
||||
{
|
||||
Debug.Assert(beatmap.BeatmapSet != null);
|
||||
downloadTracker = new BeatmapDownloadTracker(beatmap.BeatmapSet);
|
||||
AddInternal(downloadTracker);
|
||||
}
|
||||
}
|
||||
|
||||
protected override Drawable CreateContent()
|
||||
@ -505,7 +495,9 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
if (beatmapOverlay != null)
|
||||
items.Add(new OsuMenuItem("Details...", MenuItemType.Standard, () => beatmapOverlay.FetchAndShowBeatmap(Item.Beatmap.OnlineID)));
|
||||
|
||||
if (beatmap != null && collectionManager != null && downloadTracker?.State.Value == DownloadState.LocallyAvailable)
|
||||
if (collectionManager != null && beatmap != null)
|
||||
{
|
||||
if (beatmaps.QueryBeatmap(b => b.OnlineID == beatmap.OnlineID) is BeatmapInfo local && !local.BeatmapSet.AsNonNull().DeletePending)
|
||||
{
|
||||
var collectionItems = collectionManager.Collections.Select(c => new CollectionToggleMenuItem(c, beatmap)).Cast<OsuMenuItem>().ToList();
|
||||
if (manageCollectionsDialog != null)
|
||||
@ -513,6 +505,7 @@ namespace osu.Game.Screens.OnlinePlay
|
||||
|
||||
items.Add(new OsuMenuItem("Collections") { Items = collectionItems });
|
||||
}
|
||||
}
|
||||
|
||||
return items.ToArray();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user