2021-03-23 13:47:15 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2021-03-23 15:41:52 +08:00
|
|
|
using System;
|
|
|
|
using System.Diagnostics;
|
2021-03-23 14:35:06 +08:00
|
|
|
using osu.Game.Online.API;
|
|
|
|
using osu.Game.Online.Rooms;
|
2021-03-23 15:41:52 +08:00
|
|
|
using osu.Game.Online.Solo;
|
2021-03-23 14:35:06 +08:00
|
|
|
using osu.Game.Scoring;
|
|
|
|
|
2021-03-23 13:47:15 +08:00
|
|
|
namespace osu.Game.Screens.Play
|
|
|
|
{
|
2021-03-23 14:35:06 +08:00
|
|
|
public class SoloPlayer : SubmittingPlayer
|
2021-03-23 13:47:15 +08:00
|
|
|
{
|
2021-03-24 12:02:37 +08:00
|
|
|
protected override APIRequest<APIScoreToken> CreateTokenRequest()
|
2021-03-23 14:35:06 +08:00
|
|
|
{
|
2021-03-23 15:41:52 +08:00
|
|
|
if (!(Beatmap.Value.BeatmapInfo.OnlineBeatmapID is int beatmapId))
|
|
|
|
return null;
|
|
|
|
|
2021-04-09 14:18:02 +08:00
|
|
|
if (!(Ruleset.Value.ID is int rulesetId))
|
|
|
|
return null;
|
|
|
|
|
|
|
|
return new CreateSoloScoreRequest(beatmapId, rulesetId, Game.VersionHash);
|
2021-03-23 14:35:06 +08:00
|
|
|
}
|
2021-03-23 15:41:52 +08:00
|
|
|
|
|
|
|
protected override bool HandleTokenRetrievalFailure(Exception exception) => false;
|
2021-03-24 12:12:51 +08:00
|
|
|
|
|
|
|
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
|
|
|
|
{
|
|
|
|
Debug.Assert(Beatmap.Value.BeatmapInfo.OnlineBeatmapID != null);
|
|
|
|
|
|
|
|
int beatmapId = Beatmap.Value.BeatmapInfo.OnlineBeatmapID.Value;
|
|
|
|
|
|
|
|
return new SubmitSoloScoreRequest(beatmapId, token, score.ScoreInfo);
|
|
|
|
}
|
2021-03-23 13:47:15 +08:00
|
|
|
}
|
|
|
|
}
|