2020-12-04 17:18:41 +08:00
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
2020-12-04 14:34:31 +08:00
|
|
|
namespace osu.Game.Online.RealtimeMultiplayer
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// An interface defining the spectator server instance.
|
|
|
|
/// </summary>
|
|
|
|
public interface IMultiplayerServer
|
|
|
|
{
|
2020-12-04 17:18:41 +08:00
|
|
|
/// <summary>
|
|
|
|
/// Request to join a multiplayer room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="roomId">The databased room ID.</param>
|
2020-12-08 13:51:48 +08:00
|
|
|
/// <exception cref="UserAlreadyInMultiplayerRoom">If the user is already in the requested (or another) room.</exception>
|
2020-12-08 15:15:58 +08:00
|
|
|
Task<MultiplayerRoom> JoinRoom(long roomId);
|
2020-12-04 17:18:41 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Request to leave the currently joined room.
|
|
|
|
/// </summary>
|
2020-12-09 11:05:50 +08:00
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
2020-12-08 13:39:26 +08:00
|
|
|
Task LeaveRoom();
|
2020-12-08 15:32:45 +08:00
|
|
|
|
|
|
|
/// <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>
|
2020-12-08 18:06:08 +08:00
|
|
|
/// <exception cref="NotHostException">A user other than the current host is attempting to transfer host.</exception>
|
2020-12-09 11:05:50 +08:00
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
2020-12-08 15:32:45 +08:00
|
|
|
Task TransferHost(long userId);
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// As the host, update the settings of the currently joined room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="settings">The new settings to apply.</param>
|
2020-12-09 11:05:50 +08:00
|
|
|
/// <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-08 15:32:45 +08:00
|
|
|
Task ChangeSettings(MultiplayerRoomSettings settings);
|
2020-12-08 16:41:56 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// Change the local user state in the currently joined room.
|
|
|
|
/// </summary>
|
|
|
|
/// <param name="newState">The proposed new state.</param>
|
|
|
|
/// <exception cref="InvalidStateChange">If the state change requested is not valid, given the previous state or room state.</exception>
|
2020-12-09 11:05:50 +08:00
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
2020-12-08 16:41:56 +08:00
|
|
|
Task ChangeState(MultiplayerUserState newState);
|
2020-12-08 17:42:08 +08:00
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
/// As the host of a room, start the match.
|
|
|
|
/// </summary>
|
2020-12-08 18:06:08 +08:00
|
|
|
/// <exception cref="NotHostException">A user other than the current host is attempting to start the game.</exception>
|
2020-12-09 11:05:50 +08:00
|
|
|
/// <exception cref="NotJoinedRoomException">If the user is not in a room.</exception>
|
2020-12-08 17:42:08 +08:00
|
|
|
Task StartMatch();
|
2020-12-04 14:34:31 +08:00
|
|
|
}
|
2020-12-08 15:32:45 +08:00
|
|
|
}
|