mirror of
https://github.com/ppy/osu.git
synced 2025-01-06 07:02:54 +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:
commit
a13067eaa4
@ -430,21 +430,19 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
Debug.Assert(Room != null);
|
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;
|
item.ID = ++lastPlaylistItemId;
|
||||||
|
|
||||||
|
serverSidePlaylist.Add(item);
|
||||||
await ((IMultiplayerClient)this).PlaylistItemAdded(item).ConfigureAwait(false);
|
await ((IMultiplayerClient)this).PlaylistItemAdded(item).ConfigureAwait(false);
|
||||||
|
|
||||||
|
await updatePlaylistOrder(Room).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task updateCurrentItem(MultiplayerRoom room, bool notify = true)
|
private async Task updateCurrentItem(MultiplayerRoom room, bool notify = true)
|
||||||
{
|
{
|
||||||
MultiplayerPlaylistItem nextItem = serverSidePlaylist
|
// Pick the next non-expired playlist item by playlist order, or default to the most-recently-expired item.
|
||||||
.Where(i => !i.Expired)
|
MultiplayerPlaylistItem nextItem = serverSidePlaylist.Where(i => !i.Expired).OrderBy(i => i.PlaylistOrder).FirstOrDefault()
|
||||||
.OrderBy(i => i.PlaylistOrder)
|
?? serverSidePlaylist.OrderByDescending(i => i.PlayedAt).First();
|
||||||
.FirstOrDefault()
|
|
||||||
?? room.Playlist.Last();
|
|
||||||
|
|
||||||
currentIndex = serverSidePlaylist.IndexOf(nextItem);
|
currentIndex = serverSidePlaylist.IndexOf(nextItem);
|
||||||
|
|
||||||
@ -462,7 +460,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
switch (room.Settings.QueueMode)
|
switch (room.Settings.QueueMode)
|
||||||
{
|
{
|
||||||
default:
|
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;
|
break;
|
||||||
|
|
||||||
case QueueMode.AllPlayersRoundRobin:
|
case QueueMode.AllPlayersRoundRobin:
|
||||||
@ -483,7 +481,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
{
|
{
|
||||||
MultiplayerPlaylistItem candidateItem = unprocessedItems
|
MultiplayerPlaylistItem candidateItem = unprocessedItems
|
||||||
.OrderBy(item => perUserCounts[item.OwnerID])
|
.OrderBy(item => perUserCounts[item.OwnerID])
|
||||||
.ThenBy(item => item.ID == 0 ? int.MaxValue : item.ID)
|
.ThenBy(item => item.ID)
|
||||||
.First();
|
.First();
|
||||||
|
|
||||||
unprocessedItems.Remove(candidateItem);
|
unprocessedItems.Remove(candidateItem);
|
||||||
@ -504,10 +502,6 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
|||||||
|
|
||||||
item.PlaylistOrder = (ushort)i;
|
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);
|
await ((IMultiplayerClient)this).PlaylistItemChanged(item).ConfigureAwait(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user