Ensure the current room is left at a mutliplayer client level on client disconnection

This commit is contained in:
Dean Herbert
2020-12-23 15:49:22 +09:00
parent b632e44bac
commit 00d50150de
2 changed files with 14 additions and 0 deletions

View File

@ -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>