From e649a330a405d7d58490e50ea8c7f3b17cb3e27c Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Tue, 23 Mar 2021 16:41:52 +0900 Subject: [PATCH] Implement SoloPlayer's request construction --- osu.Game/Screens/Play/SoloPlayer.cs | 18 +++++++++++++++--- 1 file changed, 15 insertions(+), 3 deletions(-) diff --git a/osu.Game/Screens/Play/SoloPlayer.cs b/osu.Game/Screens/Play/SoloPlayer.cs index f2f97c5d0d..3dc9df146e 100644 --- a/osu.Game/Screens/Play/SoloPlayer.cs +++ b/osu.Game/Screens/Play/SoloPlayer.cs @@ -1,22 +1,34 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. +using System; +using System.Diagnostics; using osu.Game.Online.API; using osu.Game.Online.Rooms; +using osu.Game.Online.Solo; using osu.Game.Scoring; namespace osu.Game.Screens.Play { public class SoloPlayer : SubmittingPlayer { - public override APIRequest CreateSubmissionRequest(Score score, int token) + protected override APIRequest CreateSubmissionRequest(Score score, long token) { - throw new System.NotImplementedException(); + Debug.Assert(Beatmap.Value.BeatmapInfo.OnlineBeatmapID != null); + + int beatmapId = Beatmap.Value.BeatmapInfo.OnlineBeatmapID.Value; + + return new SubmitSoloScoreRequest(beatmapId, token, score.ScoreInfo); } protected override APIRequest CreateTokenRequestRequest() { - throw new System.NotImplementedException(); + if (!(Beatmap.Value.BeatmapInfo.OnlineBeatmapID is int beatmapId)) + return null; + + return new CreateSoloScoreRequest(beatmapId, Game.VersionHash); } + + protected override bool HandleTokenRetrievalFailure(Exception exception) => false; } }