mirror of
https://github.com/ppy/osu
synced 2025-01-19 20:40:52 +00:00
Ensure externally run operations on LoungeSubScreen
are run after load is completed
This commit is contained in:
parent
ec3ce57bb9
commit
a5736085a9
@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user