Show login overlay when attempting to update a beatmap while logged out

This commit is contained in:
Dean Herbert 2022-09-12 16:15:14 +09:00
parent 6c59be7be9
commit 94f8197e22

View File

@ -11,6 +11,8 @@ using osu.Game.Beatmaps;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Graphics.UserInterface; using osu.Game.Graphics.UserInterface;
using osu.Game.Online.API;
using osu.Game.Overlays;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
@ -22,6 +24,15 @@ namespace osu.Game.Screens.Select.Carousel
private SpriteIcon icon = null!; private SpriteIcon icon = null!;
private Box progressFill = null!; private Box progressFill = null!;
[Resolved]
private BeatmapModelDownloader beatmapDownloader { get; set; } = null!;
[Resolved]
private IAPIProvider api { get; set; } = null!;
[Resolved(canBeNull: true)]
private LoginOverlay? loginOverlay { get; set; }
public UpdateBeatmapSetButton(BeatmapSetInfo beatmapSetInfo) public UpdateBeatmapSetButton(BeatmapSetInfo beatmapSetInfo)
{ {
this.beatmapSetInfo = beatmapSetInfo; this.beatmapSetInfo = beatmapSetInfo;
@ -32,9 +43,6 @@ namespace osu.Game.Screens.Select.Carousel
Origin = Anchor.CentreLeft; Origin = Anchor.CentreLeft;
} }
[Resolved]
private BeatmapModelDownloader beatmapDownloader { get; set; } = null!;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load() private void load()
{ {
@ -90,6 +98,12 @@ namespace osu.Game.Screens.Select.Carousel
Action = () => Action = () =>
{ {
if (!api.IsLoggedIn)
{
loginOverlay?.Show();
return;
}
beatmapDownloader.DownloadAsUpdate(beatmapSetInfo); beatmapDownloader.DownloadAsUpdate(beatmapSetInfo);
attachExistingDownload(); attachExistingDownload();
}; };