1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 04:13:00 +08:00

Merge pull request #15929 from smoogipoo/update-test-multiplayer-client

Update test multiplayer client to match server implementation
This commit is contained in:
Dean Herbert 2021-12-06 15:57:08 +09:00 committed by GitHub
commit a13067eaa4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -430,21 +430,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
Debug.Assert(Room != null);
// Add the item to the list first in order to compute gameplay order.
serverSidePlaylist.Add(item);
await updatePlaylistOrder(Room).ConfigureAwait(false);
item.ID = ++lastPlaylistItemId;
serverSidePlaylist.Add(item);
await ((IMultiplayerClient)this).PlaylistItemAdded(item).ConfigureAwait(false);
await updatePlaylistOrder(Room).ConfigureAwait(false);
}
private async Task updateCurrentItem(MultiplayerRoom room, bool notify = true)
{
MultiplayerPlaylistItem nextItem = serverSidePlaylist
.Where(i => !i.Expired)
.OrderBy(i => i.PlaylistOrder)
.FirstOrDefault()
?? room.Playlist.Last();
// Pick the next non-expired playlist item by playlist order, or default to the most-recently-expired item.
MultiplayerPlaylistItem nextItem = serverSidePlaylist.Where(i => !i.Expired).OrderBy(i => i.PlaylistOrder).FirstOrDefault()
?? serverSidePlaylist.OrderByDescending(i => i.PlayedAt).First();
currentIndex = serverSidePlaylist.IndexOf(nextItem);
@ -462,7 +460,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
switch (room.Settings.QueueMode)
{
default:
orderedActiveItems = serverSidePlaylist.Where(item => !item.Expired).OrderBy(item => item.ID == 0 ? int.MaxValue : item.ID).ToList();
orderedActiveItems = serverSidePlaylist.Where(item => !item.Expired).OrderBy(item => item.ID).ToList();
break;
case QueueMode.AllPlayersRoundRobin:
@ -483,7 +481,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
{
MultiplayerPlaylistItem candidateItem = unprocessedItems
.OrderBy(item => perUserCounts[item.OwnerID])
.ThenBy(item => item.ID == 0 ? int.MaxValue : item.ID)
.ThenBy(item => item.ID)
.First();
unprocessedItems.Remove(candidateItem);
@ -504,10 +502,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
item.PlaylistOrder = (ushort)i;
// Items which have an ID of 0 are not in the database, so avoid propagating database/hub events for them.
if (item.ID <= 0)
continue;
await ((IMultiplayerClient)this).PlaylistItemChanged(item).ConfigureAwait(false);
}
}