2020-12-04 14:34:31 +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-04 14:34:31 +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-04 14:34:31 +08:00
2020-12-25 12:38:11 +08:00
namespace osu.Game.Online.Multiplayer
2020-12-04 14:34:31 +08:00
{
/// <summary>
2020-12-08 17:28:31 +08:00
/// An interface defining a multiplayer client instance.
2020-12-04 14:34:31 +08:00
/// </summary>
public interface IMultiplayerClient
{
/// <summary>
/// Signals that the room has changed state.
/// </summary>
/// <param name="state">The state of the room.</param>
Task RoomStateChanged ( MultiplayerRoomState state ) ;
2020-12-08 00:35:42 +08:00
/// <summary>
/// Signals that a user has joined the room.
/// </summary>
/// <param name="user">The user.</param>
Task UserJoined ( MultiplayerRoomUser user ) ;
/// <summary>
/// Signals that a user has left the room.
/// </summary>
/// <param name="user">The user.</param>
Task UserLeft ( MultiplayerRoomUser user ) ;
2020-12-08 13:33:38 +08:00
2021-08-11 17:26:36 +08:00
/// <summary>
/// Signals that a user has been kicked from the room.
/// </summary>
/// <remarks>
/// This will also be sent to the user that was kicked.
/// </remarks>
/// <param name="user">The user.</param>
Task UserKicked ( MultiplayerRoomUser user ) ;
2023-10-03 04:53:28 +08:00
/// <summary>
2023-10-12 17:25:20 +08:00
/// Signals that the local user has been invited into a multiplayer room.
2023-10-03 04:53:28 +08:00
/// </summary>
/// <param name="invitedBy">Id of user that invited the player.</param>
2023-10-03 07:22:25 +08:00
/// <param name="roomID">Id of the room the user got invited to.</param>
/// <param name="password">Password to join the room.</param>
Task Invited ( int invitedBy , long roomID , string password ) ;
2023-10-03 04:53:28 +08:00
2020-12-08 16:03:44 +08:00
/// <summary>
/// Signal that the host of the room has changed.
/// </summary>
/// <param name="userId">The user ID of the new host.</param>
2020-12-16 19:04:28 +08:00
Task HostChanged ( int userId ) ;
2020-12-08 16:03:44 +08:00
2020-12-08 13:33:38 +08:00
/// <summary>
/// Signals that the settings for this room have changed.
/// </summary>
/// <param name="newSettings">The updated room settings.</param>
Task SettingsChanged ( MultiplayerRoomSettings newSettings ) ;
2020-12-08 16:41:56 +08:00
/// <summary>
/// Signals that a user in this room changed their state.
/// </summary>
/// <param name="userId">The ID of the user performing a state change.</param>
/// <param name="state">The new state of the user.</param>
2020-12-16 19:04:28 +08:00
Task UserStateChanged ( int userId , MultiplayerUserState state ) ;
2020-12-08 17:42:08 +08:00
2021-07-21 17:59:02 +08:00
/// <summary>
2021-08-03 14:43:04 +08:00
/// Signals that the match type state has changed for a user in this room.
2021-07-21 17:59:02 +08:00
/// </summary>
/// <param name="userId">The ID of the user performing a state change.</param>
/// <param name="state">The new state of the user.</param>
2021-08-03 14:43:04 +08:00
Task MatchUserStateChanged ( int userId , MatchUserState state ) ;
2021-07-21 17:59:02 +08:00
/// <summary>
2021-08-03 14:43:04 +08:00
/// Signals that the match type state has changed for this room.
2021-07-21 17:59:02 +08:00
/// </summary>
/// <param name="state">The new state of the room.</param>
2021-08-03 14:43:04 +08:00
Task MatchRoomStateChanged ( MatchRoomState state ) ;
2021-07-21 17:59:02 +08:00
2021-07-26 16:38:08 +08:00
/// <summary>
2021-08-03 14:43:04 +08:00
/// Send a match type specific request.
2021-07-26 16:38:08 +08:00
/// </summary>
/// <param name="e">The event to handle.</param>
2021-08-03 14:43:04 +08:00
Task MatchEvent ( MatchServerEvent e ) ;
2021-07-26 16:38:08 +08:00
2021-01-03 09:32:50 +08:00
/// <summary>
2021-01-12 03:28:24 +08:00
/// Signals that a user in this room changed their beatmap availability state.
2021-01-03 09:32:50 +08:00
/// </summary>
/// <param name="userId">The ID of the user whose beatmap availability state has changed.</param>
/// <param name="beatmapAvailability">The new beatmap availability state of the user.</param>
Task UserBeatmapAvailabilityChanged ( int userId , BeatmapAvailability beatmapAvailability ) ;
2021-02-01 17:50:32 +08:00
/// <summary>
/// Signals that a user in this room changed their local mods.
/// </summary>
/// <param name="userId">The ID of the user whose mods have changed.</param>
/// <param name="mods">The user's new local mods.</param>
2021-02-01 16:57:32 +08:00
Task UserModsChanged ( int userId , IEnumerable < APIMod > mods ) ;
2021-02-01 16:54:56 +08:00
2020-12-08 17:42:08 +08:00
/// <summary>
2022-04-21 21:38:58 +08:00
/// Signals that the match is starting and the loading of gameplay should be started. This will *only* be sent to clients which are to begin loading at this point.
2020-12-08 17:42:08 +08:00
/// </summary>
Task LoadRequested ( ) ;
2022-04-21 21:38:58 +08:00
/// <summary>
/// Signals that loading of gameplay is to be aborted.
/// </summary>
Task LoadAborted ( ) ;
2020-12-08 17:42:08 +08:00
/// <summary>
2022-04-21 21:37:26 +08:00
/// Signals that gameplay has started.
/// All users in the <see cref="MultiplayerUserState.Loaded"/> or <see cref="MultiplayerUserState.ReadyForGameplay"/> states should begin gameplay as soon as possible.
2020-12-08 17:42:08 +08:00
/// </summary>
2022-04-21 21:37:26 +08:00
Task GameplayStarted ( ) ;
2020-12-08 17:42:08 +08:00
/// <summary>
/// Signals that the match has ended, all players have finished and results are ready to be displayed.
/// </summary>
Task ResultsReady ( ) ;
2021-10-22 15:48:28 +08:00
/// <summary>
/// Signals that an item has been added to the playlist.
/// </summary>
/// <param name="item">The added item.</param>
2021-11-15 22:14:27 +08:00
Task PlaylistItemAdded ( MultiplayerPlaylistItem item ) ;
2021-10-22 15:48:28 +08:00
/// <summary>
/// Signals that an item has been removed from the playlist.
/// </summary>
2021-11-10 18:58:25 +08:00
/// <param name="playlistItemId">The removed item.</param>
Task PlaylistItemRemoved ( long playlistItemId ) ;
2021-10-22 19:53:45 +08:00
/// <summary>
/// Signals that an item has been changed in the playlist.
/// </summary>
/// <param name="item">The changed item.</param>
2021-11-15 22:14:27 +08:00
Task PlaylistItemChanged ( MultiplayerPlaylistItem item ) ;
2020-12-04 14:34:31 +08:00
}
}