mirror of
https://github.com/osukey/osukey.git
synced 2025-08-05 23:53:51 +09:00
Fix exception when leaving match
This commit is contained in:
@ -41,7 +41,14 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
public override void OnResuming(IScreen last)
|
public override void OnResuming(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
listingPollingComponent.PollImmediately();
|
|
||||||
|
// Upon having left a room, we don't know whether we were the only participant, and whether the room is now closed as a result of leaving it.
|
||||||
|
// To work around this, temporarily clear all rooms until the next listing poll.
|
||||||
|
if (last is MultiplayerMatchSubScreen match)
|
||||||
|
{
|
||||||
|
RoomManager.RemoveRoom(match.Room);
|
||||||
|
listingPollingComponent.PollImmediately();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override FilterCriteria CreateFilterCriteria()
|
protected override FilterCriteria CreateFilterCriteria()
|
||||||
|
@ -42,6 +42,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
public override string ShortTitle => "room";
|
public override string ShortTitle => "room";
|
||||||
|
|
||||||
|
public readonly Room Room;
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private MultiplayerClient client { get; set; }
|
private MultiplayerClient client { get; set; }
|
||||||
|
|
||||||
@ -61,6 +63,8 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
public MultiplayerMatchSubScreen(Room room)
|
public MultiplayerMatchSubScreen(Room room)
|
||||||
{
|
{
|
||||||
|
Room = room;
|
||||||
|
|
||||||
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
|
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||||
Activity.Value = new UserActivity.InLobby(room);
|
Activity.Value = new UserActivity.InLobby(room);
|
||||||
}
|
}
|
||||||
@ -323,10 +327,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
// We don't know whether we're the only participant in the room, and whether the room will close after we leave it as a result.
|
|
||||||
// To work around this, temporarily remove the room until the next listing poll retrieves it.
|
|
||||||
RoomManager?.RemoveRoom(currentRoom.Value);
|
|
||||||
|
|
||||||
// the room may not be left immediately after a disconnection due to async flow,
|
// the room may not be left immediately after a disconnection due to async flow,
|
||||||
// so checking the IsConnected status is also required.
|
// so checking the IsConnected status is also required.
|
||||||
if (client.Room == null || !client.IsConnected.Value)
|
if (client.Room == null || !client.IsConnected.Value)
|
||||||
|
Reference in New Issue
Block a user