mirror of
https://github.com/osukey/osukey.git
synced 2025-08-07 16:43:52 +09:00
Use BindValueChanged to show main content for new multiplayer and playlist rooms when the settings overlay is hidden.
This commit is contained in:
@ -39,15 +39,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
|
|
||||||
private MultiplayerMatchSettingsOverlay settingsOverlay;
|
private MultiplayerMatchSettingsOverlay settingsOverlay;
|
||||||
|
|
||||||
private readonly Bindable<Visibility> settingsOverlayVisibility = new Bindable<Visibility>();
|
|
||||||
|
|
||||||
private GridContainer subScreenContainer;
|
|
||||||
|
|
||||||
private IBindable<bool> isConnected;
|
private IBindable<bool> isConnected;
|
||||||
|
|
||||||
[CanBeNull]
|
[CanBeNull]
|
||||||
private IDisposable readyClickOperation;
|
private IDisposable readyClickOperation;
|
||||||
|
|
||||||
|
private GridContainer mainContent;
|
||||||
|
|
||||||
public MultiplayerMatchSubScreen(Room room)
|
public MultiplayerMatchSubScreen(Room room)
|
||||||
{
|
{
|
||||||
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
|
Title = room.RoomID.Value == null ? "New room" : room.Name.Value;
|
||||||
@ -59,7 +57,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
subScreenContainer = new GridContainer
|
mainContent = new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
@ -183,9 +181,16 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
subScreenContainer.Hide();
|
if (client.Room == null)
|
||||||
settingsOverlayVisibility.BindTo(settingsOverlay.State);
|
{
|
||||||
settingsOverlayVisibility.ValueChanged += settingsOverlayVisibilityChanged;
|
mainContent.Hide();
|
||||||
|
|
||||||
|
settingsOverlay.State.BindValueChanged(visibility =>
|
||||||
|
{
|
||||||
|
if (visibility.NewValue == Visibility.Hidden)
|
||||||
|
mainContent.Show();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
@ -266,22 +271,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
|
|||||||
readyClickOperation = null;
|
readyClickOperation = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void settingsOverlayVisibilityChanged(ValueChangedEvent<Visibility> settingsOverlayVisibilityChangedEvent)
|
|
||||||
{
|
|
||||||
if (client.Room != null)
|
|
||||||
{
|
|
||||||
subScreenContainer.Show();
|
|
||||||
settingsOverlayVisibility.ValueChanged -= settingsOverlayVisibilityChanged;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
if (settingsOverlayVisibilityChangedEvent.NewValue == Visibility.Visible)
|
|
||||||
subScreenContainer.Hide();
|
|
||||||
else
|
|
||||||
subScreenContainer.Show();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void Dispose(bool isDisposing)
|
protected override void Dispose(bool isDisposing)
|
||||||
{
|
{
|
||||||
base.Dispose(isDisposing);
|
base.Dispose(isDisposing);
|
||||||
|
@ -33,6 +33,8 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
|
|
||||||
private OverlinedHeader participantsHeader;
|
private OverlinedHeader participantsHeader;
|
||||||
|
|
||||||
|
private GridContainer mainContent;
|
||||||
|
|
||||||
public PlaylistsRoomSubScreen(Room room)
|
public PlaylistsRoomSubScreen(Room room)
|
||||||
{
|
{
|
||||||
Title = room.RoomID.Value == null ? "New playlist" : room.Name.Value;
|
Title = room.RoomID.Value == null ? "New playlist" : room.Name.Value;
|
||||||
@ -44,7 +46,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
{
|
{
|
||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
new GridContainer
|
mainContent = new GridContainer
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Content = new[]
|
Content = new[]
|
||||||
@ -190,6 +192,17 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
|
|||||||
State = { Value = roomId.Value == null ? Visibility.Visible : Visibility.Hidden }
|
State = { Value = roomId.Value == null ? Visibility.Visible : Visibility.Hidden }
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (roomId.Value == null)
|
||||||
|
{
|
||||||
|
mainContent.Hide();
|
||||||
|
|
||||||
|
settingsOverlay.State.BindValueChanged(visibility =>
|
||||||
|
{
|
||||||
|
if (visibility.NewValue == Visibility.Hidden)
|
||||||
|
mainContent.Show();
|
||||||
|
}, true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
|
Reference in New Issue
Block a user