1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-12 21:52:55 +08:00

Add InvitePlayer method to multiplayer server

This commit is contained in:
Marvin Schürz 2023-10-02 22:31:47 +02:00
parent d701a25969
commit d19cdbdefb
3 changed files with 19 additions and 0 deletions

View File

@ -99,5 +99,12 @@ namespace osu.Game.Online.Multiplayer
/// </summary> /// </summary>
/// <param name="playlistItemId">The item to remove.</param> /// <param name="playlistItemId">The item to remove.</param>
Task RemovePlaylistItem(long playlistItemId); Task RemovePlaylistItem(long playlistItemId);
/// <summary>
/// Invites a player to the current room.
/// </summary>
/// <param name="userId"></param>
/// <returns></returns>
Task InvitePlayer(int userId);
} }
} }

View File

@ -260,6 +260,8 @@ namespace osu.Game.Online.Multiplayer
protected abstract Task LeaveRoomInternal(); protected abstract Task LeaveRoomInternal();
public abstract Task InvitePlayer(int userId);
/// <summary> /// <summary>
/// Change the current <see cref="MultiplayerRoom"/> settings. /// Change the current <see cref="MultiplayerRoom"/> settings.
/// </summary> /// </summary>

View File

@ -106,6 +106,16 @@ namespace osu.Game.Online.Multiplayer
return connection.InvokeAsync(nameof(IMultiplayerServer.LeaveRoom)); return connection.InvokeAsync(nameof(IMultiplayerServer.LeaveRoom));
} }
public override Task InvitePlayer(int userId)
{
if (!IsConnected.Value)
return Task.CompletedTask;
Debug.Assert(connection != null);
return connection.InvokeAsync(nameof(IMultiplayerServer.InvitePlayer), userId);
}
public override Task TransferHost(int userId) public override Task TransferHost(int userId)
{ {
if (!IsConnected.Value) if (!IsConnected.Value)