Merge branch 'master' into new-multiplayer-playlist

This commit is contained in:
Dan Balasescu
2021-12-01 21:11:16 +09:00
22 changed files with 579 additions and 198 deletions

View File

@ -699,6 +699,7 @@ namespace osu.Game.Online.Multiplayer
Room.Settings = settings;
APIRoom.Name.Value = Room.Settings.Name;
APIRoom.Password.Value = Room.Settings.Password;
APIRoom.Type.Value = Room.Settings.MatchType;
APIRoom.QueueMode.Value = Room.Settings.QueueMode;
RoomUpdated?.Invoke();
@ -707,15 +708,7 @@ namespace osu.Game.Online.Multiplayer
private async Task<PlaylistItem> createPlaylistItem(MultiplayerPlaylistItem item)
{
var set = await GetOnlineBeatmapSet(item.BeatmapID).ConfigureAwait(false);
// The incoming response is deserialised without circular reference handling currently.
// Because we require using metadata from this instance, populate the nested beatmaps' sets manually here.
foreach (var b in set.Beatmaps)
b.BeatmapSet = set;
var beatmap = set.Beatmaps.Single(b => b.OnlineID == item.BeatmapID);
beatmap.Checksum = item.BeatmapChecksum;
var apiBeatmap = await GetAPIBeatmap(item.BeatmapID).ConfigureAwait(false);
var ruleset = Rulesets.GetRuleset(item.RulesetID);
var rulesetInstance = ruleset.CreateInstance();
@ -724,7 +717,7 @@ namespace osu.Game.Online.Multiplayer
{
ID = item.ID,
OwnerID = item.OwnerID,
Beatmap = { Value = beatmap },
Beatmap = { Value = apiBeatmap },
Ruleset = { Value = ruleset },
Expired = item.Expired
};
@ -736,12 +729,12 @@ namespace osu.Game.Online.Multiplayer
}
/// <summary>
/// Retrieves a <see cref="APIBeatmapSet"/> from an online source.
/// Retrieves a <see cref="APIBeatmap"/> from an online source.
/// </summary>
/// <param name="beatmapId">The beatmap set ID.</param>
/// <param name="beatmapId">The beatmap ID.</param>
/// <param name="cancellationToken">A token to cancel the request.</param>
/// <returns>The <see cref="APIBeatmapSet"/> retrieval task.</returns>
protected abstract Task<APIBeatmapSet> GetOnlineBeatmapSet(int beatmapId, CancellationToken cancellationToken = default);
/// <returns>The <see cref="APIBeatmap"/> retrieval task.</returns>
protected abstract Task<APIBeatmap> GetAPIBeatmap(int beatmapId, CancellationToken cancellationToken = default);
/// <summary>
/// For the provided user ID, update whether the user is included in <see cref="CurrentMatchPlayingUserIds"/>.