Ensure externally run operations on LoungeSubScreen are run after load is completed

This commit is contained in:
Dean Herbert 2021-07-23 02:23:37 +09:00
parent ec3ce57bb9
commit a5736085a9
2 changed files with 19 additions and 14 deletions

View File

@ -177,7 +177,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
this.HidePopover();
}
public void Join(Room room, string password)
public void Join(Room room, string password) => Schedule(() =>
{
if (joiningRoomOperation != null)
return;
@ -194,25 +194,22 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
joiningRoomOperation?.Dispose();
joiningRoomOperation = null;
});
}
private void updateLoadingLayer()
{
if (operationInProgress.Value || !initialRoomsReceived.Value)
loadingLayer.Show();
else
loadingLayer.Hide();
}
});
/// <summary>
/// Push a room as a new subscreen.
/// </summary>
public virtual void Open(Room room)
public void Open(Room room) => Schedule(() =>
{
// Handles the case where a room is clicked 3 times in quick succession
if (!this.IsCurrentScreen())
return;
OpenNewRoom(room);
});
protected virtual void OpenNewRoom(Room room)
{
selectedRoom.Value = room;
this.Push(CreateRoomSubScreen(room));
@ -221,5 +218,13 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
protected abstract FilterControl CreateFilterControl();
protected abstract RoomSubScreen CreateRoomSubScreen(Room room);
private void updateLoadingLayer()
{
if (operationInProgress.Value || !initialRoomsReceived.Value)
loadingLayer.Show();
else
loadingLayer.Hide();
}
}
}

View File

@ -20,15 +20,15 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
[Resolved]
private MultiplayerClient client { get; set; }
public override void Open(Room room)
protected override void OpenNewRoom(Room room)
{
if (!client.IsConnected.Value)
if (client?.IsConnected.Value != true)
{
Logger.Log("Not currently connected to the multiplayer server.", LoggingTarget.Runtime, LogLevel.Important);
return;
}
base.Open(room);
base.OpenNewRoom(room);
}
}
}