2020-12-16 11:31:05 +08:00
|
|
|
// 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.
|
|
|
|
|
2022-06-17 15:37:17 +08:00
|
|
|
#nullable disable
|
|
|
|
|
2021-02-01 16:54:56 +08:00
|
|
|
using System.Collections.Generic;
|
2020-12-16 11:31:05 +08:00
|
|
|
using System.Threading.Tasks;
|
2021-02-01 16:54:56 +08:00
|
|
|
using osu.Game.Online.API;
|
2021-01-03 09:32:50 +08:00
|
|
|
using osu.Game.Online.Rooms;
|
2020-12-16 11:31:05 +08:00
|
|
|
|
2020-12-25 12:38:11 +08:00
|
|
|
namespace osu.Game.Online.Multiplayer
|
2020-12-16 11:31:05 +08:00
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Interface for an in-room multiplayer server.
|
|
|
|
/// </summary>
|
|
|
|
public interface IMultiplayerRoomServer
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Request to leave the currently joined room.
|
|
|
|
/// </summary>
|
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
|
|
|
Task LeaveRoom();
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Transfer the host of the currently joined room to another user in the room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="userId">The new user which is to become host.</param>
|
|
|
|
/// <exception cref="NotHostException">A user other than the current host is attempting to transfer host.</exception>
|
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
2020-12-16 19:04:28 +08:00
|
|
|
Task TransferHost(int userId);
|
2020-12-16 11:31:05 +08:00
|
|
|
|
2021-08-11 16:20:41 +08:00
|
|
|
/// <summary>
|
|
|
|
/// As the host, kick another user from the room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="userId">The user to kick..</param>
|
|
|
|
/// <exception cref="NotHostException">A user other than the current host is attempting to kick a user.</exception>
|
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
|
|
|
Task KickUser(int userId);
|
|
|
|
|
2020-12-16 11:31:05 +08:00
|
|
|
/// <summary>
|
|
|
|
/// As the host, update the settings of the currently joined room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="settings">The new settings to apply.</param>
|
|
|
|
/// <exception cref="NotHostException">A user other than the current host is attempting to transfer host.</exception>
|
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
|
|
|
Task ChangeSettings(MultiplayerRoomSettings settings);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change the local user state in the currently joined room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="newState">The proposed new state.</param>
|
|
|
|
/// <exception cref="InvalidStateChangeException">If the state change requested is not valid, given the previous state or room state.</exception>
|
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
|
|
|
Task ChangeState(MultiplayerUserState newState);
|
|
|
|
|
2021-01-03 09:32:50 +08:00
|
|
|
/// <summary>
|
2021-01-12 03:28:24 +08:00
|
|
|
/// Change the local user's availability state of the current beatmap set in joined room.
|
2021-01-03 09:32:50 +08:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="newBeatmapAvailability">The proposed new beatmap availability state.</param>
|
|
|
|
Task ChangeBeatmapAvailability(BeatmapAvailability newBeatmapAvailability);
|
|
|
|
|
2021-02-01 17:50:32 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Change the local user's mods in the currently joined room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="newMods">The proposed new mods, excluding any required by the room itself.</param>
|
2021-02-01 16:57:32 +08:00
|
|
|
Task ChangeUserMods(IEnumerable<APIMod> newMods);
|
2021-02-01 16:54:56 +08:00
|
|
|
|
2021-07-21 18:13:56 +08:00
|
|
|
/// <summary>
|
2021-08-03 14:43:04 +08:00
|
|
|
/// Send a match type specific request.
|
2021-07-21 18:13:56 +08:00
|
|
|
/// </summary>
|
|
|
|
/// <param name="request">The request to send.</param>
|
2021-08-03 14:43:04 +08:00
|
|
|
Task SendMatchRequest(MatchUserRequest request);
|
2021-07-21 18:13:56 +08:00
|
|
|
|
2020-12-16 11:31:05 +08:00
|
|
|
/// <summary>
|
|
|
|
/// As the host of a room, start the match.
|
|
|
|
/// </summary>
|
|
|
|
/// <exception cref="NotHostException">A user other than the current host is attempting to start the game.</exception>
|
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
|
|
|
/// <exception cref="InvalidStateException">If an attempt to start the game occurs when the game's (or users') state disallows it.</exception>
|
|
|
|
Task StartMatch();
|
2021-10-22 15:48:28 +08:00
|
|
|
|
2021-12-14 10:30:42 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Aborts an ongoing gameplay load.
|
|
|
|
/// </summary>
|
2021-12-14 15:52:57 +08:00
|
|
|
Task AbortGameplay();
|
2021-12-14 10:30:42 +08:00
|
|
|
|
2021-10-22 15:48:28 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Adds an item to the playlist.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="item">The item to add.</param>
|
2021-11-15 22:14:27 +08:00
|
|
|
Task AddPlaylistItem(MultiplayerPlaylistItem item);
|
2021-12-09 01:12:33 +08:00
|
|
|
|
2021-12-10 13:44:35 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Edits an existing playlist item with new values.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="item">The item to edit, containing new properties. Must have an ID.</param>
|
|
|
|
Task EditPlaylistItem(MultiplayerPlaylistItem item);
|
|
|
|
|
2021-12-09 01:12:33 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Removes an item from the playlist.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="playlistItemId">The item to remove.</param>
|
|
|
|
Task RemovePlaylistItem(long playlistItemId);
|
2020-12-16 11:31:05 +08:00
|
|
|
}
|
|
|
|
}
|