1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 13:37:25 +08:00

Merge pull request #20257 from peppy/update-button-show-login

Show login overlay when attempting to update a beatmap while logged out
This commit is contained in:
Dan Balasescu 2022-09-12 17:51:45 +09:00 committed by GitHub
commit 3cfacb5e39
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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