Merge pull request #13980 from peppy/fix-online-song-select-background

Fix song select background not showing in multiplayer/playlists
This commit is contained in:
Dan Balasescu 2021-07-26 15:16:39 +09:00 committed by GitHub
commit 488dd3ea52
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 21 additions and 19 deletions

View File

@ -79,6 +79,7 @@ namespace osu.Game.Tests.Visual.Multiplayer
AddStep("load multiplayer", () => LoadScreen(multiplayerScreen)); AddStep("load multiplayer", () => LoadScreen(multiplayerScreen));
AddUntilStep("wait for multiplayer to load", () => multiplayerScreen.IsLoaded); AddUntilStep("wait for multiplayer to load", () => multiplayerScreen.IsLoaded);
AddUntilStep("wait for lounge to load", () => this.ChildrenOfType<MultiplayerLoungeSubScreen>().FirstOrDefault()?.IsLoaded == true);
} }
[Test] [Test]

View File

@ -177,7 +177,7 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
this.HidePopover(); this.HidePopover();
} }
public void Join(Room room, string password) public void Join(Room room, string password) => Schedule(() =>
{ {
if (joiningRoomOperation != null) if (joiningRoomOperation != null)
return; return;
@ -194,25 +194,22 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
joiningRoomOperation?.Dispose(); joiningRoomOperation?.Dispose();
joiningRoomOperation = null; joiningRoomOperation = null;
}); });
} });
private void updateLoadingLayer()
{
if (operationInProgress.Value || !initialRoomsReceived.Value)
loadingLayer.Show();
else
loadingLayer.Hide();
}
/// <summary> /// <summary>
/// Push a room as a new subscreen. /// Push a room as a new subscreen.
/// </summary> /// </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 // Handles the case where a room is clicked 3 times in quick succession
if (!this.IsCurrentScreen()) if (!this.IsCurrentScreen())
return; return;
OpenNewRoom(room);
});
protected virtual void OpenNewRoom(Room room)
{
selectedRoom.Value = room; selectedRoom.Value = room;
this.Push(CreateRoomSubScreen(room)); this.Push(CreateRoomSubScreen(room));
@ -221,5 +218,13 @@ namespace osu.Game.Screens.OnlinePlay.Lounge
protected abstract FilterControl CreateFilterControl(); protected abstract FilterControl CreateFilterControl();
protected abstract RoomSubScreen CreateRoomSubScreen(Room room); 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] [Resolved]
private MultiplayerClient client { get; set; } 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); Logger.Log("Not currently connected to the multiplayer server.", LoggingTarget.Runtime, LogLevel.Important);
return; return;
} }
base.Open(room); base.OpenNewRoom(room);
} }
} }
} }

View File

@ -162,10 +162,6 @@ namespace osu.Game.Screens.OnlinePlay
ongoingOperationTracker, ongoingOperationTracker,
} }
}; };
// a lot of the functionality in this class depends on loungeSubScreen being in a ready to go state.
// as such, we intentionally load this inline so it is ready alongside this screen.
LoadComponent(loungeSubScreen = CreateLounge());
} }
private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() => private void onlineStateChanged(ValueChangedEvent<APIState> state) => Schedule(() =>
@ -184,7 +180,7 @@ namespace osu.Game.Screens.OnlinePlay
screenStack.ScreenPushed += screenPushed; screenStack.ScreenPushed += screenPushed;
screenStack.ScreenExited += screenExited; screenStack.ScreenExited += screenExited;
screenStack.Push(loungeSubScreen); screenStack.Push(loungeSubScreen = CreateLounge());
apiState.BindTo(API.State); apiState.BindTo(API.State);
apiState.BindValueChanged(onlineStateChanged, true); apiState.BindValueChanged(onlineStateChanged, true);