1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 19:27:24 +08:00

Revert "Update direct download button state on beatmap import and removal"

This reverts commit 11234d3c60.
This commit is contained in:
Roman Kapustin 2019-02-13 22:04:49 +03:00
parent 11234d3c60
commit 99046f16e8
2 changed files with 9 additions and 20 deletions

View File

@ -76,9 +76,6 @@ namespace osu.Game.Overlays.Direct
{
this.colours = colours;
beatmaps.ItemAdded += (set, existing, silent) => updateState(BeatmapSet.Value);
beatmaps.ItemRemoved += set => updateState(BeatmapSet.Value);
button.Action = () =>
{
switch (State.Value)
@ -97,12 +94,6 @@ namespace osu.Game.Overlays.Direct
};
}
private void updateState(BeatmapSetInfo set)
{
if (set.OnlineBeatmapSetID == BeatmapSet.Value.OnlineBeatmapSetID)
UpdateState(BeatmapSet.Value);
}
private void updateState(DownloadState state)
{
switch (state)

View File

@ -34,7 +34,15 @@ namespace osu.Game.Overlays.Direct
{
this.beatmaps = beatmaps;
BeatmapSet.BindValueChanged(UpdateState, true);
BeatmapSet.BindValueChanged(set =>
{
if (set == null)
attachDownload(null);
else if (beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID).Any())
State.Value = DownloadState.LocallyAvailable;
else
attachDownload(beatmaps.GetExistingDownload(set));
}, true);
beatmaps.BeatmapDownloadBegan += download =>
{
@ -45,16 +53,6 @@ namespace osu.Game.Overlays.Direct
beatmaps.ItemAdded += setAdded;
}
protected void UpdateState(BeatmapSetInfo set)
{
if (set == null)
attachDownload(null);
else if (this.beatmaps.QueryBeatmapSets(s => s.OnlineBeatmapSetID == set.OnlineBeatmapSetID && !s.DeletePending).Any())
State.Value = DownloadState.LocallyAvailable;
else
attachDownload(this.beatmaps.GetExistingDownload(set));
}
#region Disposal
protected override void Dispose(bool isDisposing)