mirror of
https://github.com/ppy/osu.git
synced 2025-01-08 06:52:59 +08:00
Add additional gameplay metadata to room score request
This commit is contained in:
parent
0ebea77392
commit
bfeb90c1b6
@ -1,8 +1,10 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System.Globalization;
|
||||||
using System.Net.Http;
|
using System.Net.Http;
|
||||||
using osu.Framework.IO.Network;
|
using osu.Framework.IO.Network;
|
||||||
|
using osu.Game.Beatmaps;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
|
|
||||||
namespace osu.Game.Online.Rooms
|
namespace osu.Game.Online.Rooms
|
||||||
@ -11,12 +13,16 @@ namespace osu.Game.Online.Rooms
|
|||||||
{
|
{
|
||||||
private readonly long roomId;
|
private readonly long roomId;
|
||||||
private readonly long playlistItemId;
|
private readonly long playlistItemId;
|
||||||
|
private readonly BeatmapInfo beatmapInfo;
|
||||||
|
private readonly int rulesetId;
|
||||||
private readonly string versionHash;
|
private readonly string versionHash;
|
||||||
|
|
||||||
public CreateRoomScoreRequest(long roomId, long playlistItemId, string versionHash)
|
public CreateRoomScoreRequest(long roomId, long playlistItemId, BeatmapInfo beatmapInfo, int rulesetId, string versionHash)
|
||||||
{
|
{
|
||||||
this.roomId = roomId;
|
this.roomId = roomId;
|
||||||
this.playlistItemId = playlistItemId;
|
this.playlistItemId = playlistItemId;
|
||||||
|
this.beatmapInfo = beatmapInfo;
|
||||||
|
this.rulesetId = rulesetId;
|
||||||
this.versionHash = versionHash;
|
this.versionHash = versionHash;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -25,6 +31,8 @@ namespace osu.Game.Online.Rooms
|
|||||||
var req = base.CreateWebRequest();
|
var req = base.CreateWebRequest();
|
||||||
req.Method = HttpMethod.Post;
|
req.Method = HttpMethod.Post;
|
||||||
req.AddParameter("version_hash", versionHash);
|
req.AddParameter("version_hash", versionHash);
|
||||||
|
req.AddParameter("beatmap_hash", beatmapInfo.MD5Hash);
|
||||||
|
req.AddParameter("ruleset_id", rulesetId.ToString(CultureInfo.InvariantCulture));
|
||||||
return req;
|
return req;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
#nullable disable
|
#nullable disable
|
||||||
|
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
|
using osu.Game.Extensions;
|
||||||
using osu.Game.Online.API;
|
using osu.Game.Online.API;
|
||||||
using osu.Game.Online.Rooms;
|
using osu.Game.Online.Rooms;
|
||||||
using osu.Game.Scoring;
|
using osu.Game.Scoring;
|
||||||
@ -30,7 +31,16 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!(Room.RoomID.Value is long roomId))
|
if (!(Room.RoomID.Value is long roomId))
|
||||||
return null;
|
return null;
|
||||||
|
|
||||||
return new CreateRoomScoreRequest(roomId, PlaylistItem.ID, Game.VersionHash);
|
int beatmapId = Beatmap.Value.BeatmapInfo.OnlineID;
|
||||||
|
int rulesetId = Ruleset.Value.OnlineID;
|
||||||
|
|
||||||
|
if (beatmapId <= 0)
|
||||||
|
return null;
|
||||||
|
|
||||||
|
if (!Ruleset.Value.IsLegacyRuleset())
|
||||||
|
return null;
|
||||||
|
|
||||||
|
return new CreateRoomScoreRequest(roomId, PlaylistItem.ID, Beatmap.Value.BeatmapInfo, rulesetId, Game.VersionHash);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
|
protected override APIRequest<MultiplayerScore> CreateSubmissionRequest(Score score, long token)
|
||||||
|
Loading…
Reference in New Issue
Block a user