mirror of
https://github.com/ppy/osu.git
synced 2025-02-14 01:42:59 +08:00
Ensure the current room is left at a mutliplayer client level on client disconnection
This commit is contained in:
parent
b632e44bac
commit
00d50150de
@ -130,7 +130,11 @@ namespace osu.Game.Online.RealtimeMultiplayer
|
||||
public override async Task LeaveRoom()
|
||||
{
|
||||
if (!isConnected.Value)
|
||||
{
|
||||
// even if not connected, make sure the local room state can be cleaned up.
|
||||
await base.LeaveRoom();
|
||||
return;
|
||||
}
|
||||
|
||||
if (Room == null)
|
||||
return;
|
||||
|
@ -75,6 +75,16 @@ namespace osu.Game.Online.RealtimeMultiplayer
|
||||
// Todo: This is temporary, until the multiplayer server returns the item id on match start or otherwise.
|
||||
private int playlistItemId;
|
||||
|
||||
protected StatefulMultiplayerClient()
|
||||
{
|
||||
IsConnected.BindValueChanged(connected =>
|
||||
{
|
||||
// clean up local room state on server disconnect.
|
||||
if (!connected.NewValue)
|
||||
LeaveRoom();
|
||||
});
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Joins the <see cref="MultiplayerRoom"/> for a given API <see cref="Room"/>.
|
||||
/// </summary>
|
||||
|
Loading…
Reference in New Issue
Block a user