1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-15 11:07:19 +08:00

Merge pull request #12743 from smoogipoo/fix-submission-failure-autoplay

Fix autoplay scores being submitted
This commit is contained in:
Dean Herbert 2021-05-11 12:16:58 +09:00 committed by GitHub
commit 9c970a9eaf
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text.
using System;
using System.Linq;
using System.Threading.Tasks;
using JetBrains.Annotations;
using osu.Framework.Allocation;
@ -9,6 +10,7 @@ using osu.Framework.Logging;
using osu.Framework.Screens;
using osu.Game.Online.API;
using osu.Game.Online.Rooms;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring;
namespace osu.Game.Screens.Play
@ -33,9 +35,8 @@ namespace osu.Game.Screens.Play
protected override void LoadAsyncComplete()
{
if (!handleTokenRetrieval()) return;
base.LoadAsyncComplete();
handleTokenRetrieval();
}
private bool handleTokenRetrieval()
@ -43,6 +44,12 @@ namespace osu.Game.Screens.Play
// Token request construction should happen post-load to allow derived classes to potentially prepare DI backings that are used to create the request.
var tcs = new TaskCompletionSource<bool>();
if (Mods.Value.Any(m => m is ModAutoplay))
{
handleTokenFailure(new InvalidOperationException("Autoplay loaded."));
return false;
}
if (!api.IsLoggedIn)
{
handleTokenFailure(new InvalidOperationException("API is not online."));