1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 17:02:55 +08:00

Fix download button being visible for already downloaded playlist items

This commit is contained in:
Dean Herbert 2020-02-15 16:56:11 +09:00
parent e8f1335b47
commit 7c29327167

View File

@ -18,6 +18,7 @@ using osu.Game.Beatmaps.Drawables;
using osu.Game.Graphics;
using osu.Game.Graphics.Containers;
using osu.Game.Graphics.UserInterface;
using osu.Game.Online;
using osu.Game.Online.Chat;
using osu.Game.Online.Multiplayer;
using osu.Game.Overlays.Direct;
@ -194,10 +195,9 @@ namespace osu.Game.Screens.Multi
Alpha = allowEdit ? 1 : 0,
Action = () => RequestDeletion?.Invoke(Model),
},
new PanelDownloadButton(item.Beatmap.Value.BeatmapSet)
new PlaylistDownloadButton(item.Beatmap.Value.BeatmapSet)
{
Size = new Vector2(50, 30),
Alpha = allowEdit ? 0 : 1
Size = new Vector2(50, 30)
}
}
}
@ -211,6 +211,27 @@ namespace osu.Game.Screens.Multi
return true;
}
private class PlaylistDownloadButton : PanelDownloadButton
{
public PlaylistDownloadButton(BeatmapSetInfo beatmapSet, bool noVideo = false)
: base(beatmapSet, noVideo)
{
Alpha = 0;
}
protected override void LoadComplete()
{
base.LoadComplete();
State.BindValueChanged(stateChanged, true);
}
private void stateChanged(ValueChangedEvent<DownloadState> state)
{
this.FadeTo(state.NewValue == DownloadState.LocallyAvailable ? 0 : 1, 500);
}
}
// For now, this is the same implementation as in PanelBackground, but supports a beatmap info rather than a working beatmap
private class PanelBackground : Container // todo: should be a buffered container (https://github.com/ppy/osu-framework/issues/3222)
{