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

View File

@ -2,6 +2,7 @@
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System; using System;
using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Allocation; using osu.Framework.Allocation;
@ -9,6 +10,7 @@ using osu.Framework.Logging;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Game.Online.API; using osu.Game.Online.API;
using osu.Game.Online.Rooms; using osu.Game.Online.Rooms;
using osu.Game.Rulesets.Mods;
using osu.Game.Scoring; using osu.Game.Scoring;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
@ -33,9 +35,8 @@ namespace osu.Game.Screens.Play
protected override void LoadAsyncComplete() protected override void LoadAsyncComplete()
{ {
if (!handleTokenRetrieval()) return;
base.LoadAsyncComplete(); base.LoadAsyncComplete();
handleTokenRetrieval();
} }
private bool 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. // 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>(); var tcs = new TaskCompletionSource<bool>();
if (Mods.Value.Any(m => m is ModAutoplay))
{
handleTokenFailure(new InvalidOperationException("Autoplay loaded."));
return false;
}
if (!api.IsLoggedIn) if (!api.IsLoggedIn)
{ {
handleTokenFailure(new InvalidOperationException("API is not online.")); handleTokenFailure(new InvalidOperationException("API is not online."));