mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Add client-side + interface implementation
This commit is contained in:
@ -339,6 +339,36 @@ namespace osu.Game.Tests.Visual.Multiplayer
|
||||
|
||||
public override Task AddPlaylistItem(MultiplayerPlaylistItem item) => AddUserPlaylistItem(api.LocalUser.Value.OnlineID, item);
|
||||
|
||||
public async Task RemoveUserPlaylistItem(int userId, long playlistItemId)
|
||||
{
|
||||
Debug.Assert(Room != null);
|
||||
Debug.Assert(APIRoom != null);
|
||||
|
||||
if (Room.Settings.QueueMode == QueueMode.HostOnly)
|
||||
throw new InvalidOperationException("Items cannot be removed in host-only mode.");
|
||||
|
||||
if (Room.Playlist.Count == 1)
|
||||
throw new InvalidOperationException("The singular item in the room cannot be removed.");
|
||||
|
||||
var item = serverSidePlaylist.Find(i => i.ID == playlistItemId);
|
||||
|
||||
if (item == null)
|
||||
throw new InvalidOperationException("Item does not exist in the room.");
|
||||
|
||||
if (item == currentItem)
|
||||
throw new InvalidOperationException("The room's current item cannot be removed.");
|
||||
|
||||
if (item.OwnerID != userId)
|
||||
throw new InvalidOperationException("Attempted to remove an item which is not owned by the user.");
|
||||
|
||||
serverSidePlaylist.Remove(item);
|
||||
await ((IMultiplayerClient)this).PlaylistItemRemoved(playlistItemId).ConfigureAwait(false);
|
||||
|
||||
await updateCurrentItem(Room).ConfigureAwait(false);
|
||||
}
|
||||
|
||||
public override Task RemovePlaylistItem(long playlistItemId) => RemoveUserPlaylistItem(api.LocalUser.Value.OnlineID, playlistItemId);
|
||||
|
||||
protected override Task<APIBeatmap> GetAPIBeatmap(int beatmapId, CancellationToken cancellationToken = default)
|
||||
{
|
||||
IBeatmapSetInfo? set = roomManager.ServerSideRooms.SelectMany(r => r.Playlist)
|
||||
|
Reference in New Issue
Block a user