mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 12:33:01 +08:00
Use the client.RoomUpdated action instead of binding the value of the settings overlay visibility and creating an event from it based on its ValueChanged action.
This commit is contained in:
parent
5233a0449a
commit
cbfb999c28
@ -39,8 +39,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
private MultiplayerMatchSettingsOverlay settingsOverlay;
|
private MultiplayerMatchSettingsOverlay settingsOverlay;
|
||||||
|
|
||||||
private readonly Bindable<Visibility> settingsOverlayVisibility = new Bindable<Visibility>();
|
|
||||||
|
|
||||||
private GridContainer subScreenContainer;
|
private GridContainer subScreenContainer;
|
||||||
|
|
||||||
private IBindable<bool> isConnected;
|
private IBindable<bool> isConnected;
|
||||||
@ -184,8 +182,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
};
|
};
|
||||||
|
|
||||||
subScreenContainer.Hide();
|
subScreenContainer.Hide();
|
||||||
settingsOverlayVisibility.BindTo(settingsOverlay.State);
|
client.RoomUpdated += roomUpdated;
|
||||||
settingsOverlayVisibility.ValueChanged += settingsOverlayVisibilityChanged;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -266,19 +263,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
readyClickOperation = null;
|
readyClickOperation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void settingsOverlayVisibilityChanged(ValueChangedEvent<Visibility> settingsOverlayVisibilityChangedEvent)
|
private void roomUpdated()
|
||||||
{
|
{
|
||||||
if (client.Room != null)
|
if (client.Room != null)
|
||||||
{
|
{
|
||||||
|
// If the room is updated and is not null, show the room sub screen container and unsubscribe.
|
||||||
subScreenContainer.Show();
|
subScreenContainer.Show();
|
||||||
settingsOverlayVisibility.ValueChanged -= settingsOverlayVisibilityChanged;
|
client.RoomUpdated -= roomUpdated;
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (settingsOverlayVisibilityChangedEvent.NewValue == Visibility.Visible)
|
|
||||||
subScreenContainer.Hide();
|
|
||||||
else
|
|
||||||
subScreenContainer.Show();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user