1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 18:33:22 +08:00

Move RoomSettingsOverlay to RoomSubScreen

This commit is contained in:
smoogipoo 2021-08-17 18:24:04 +09:00
parent 6840ec6716
commit 590d814881
4 changed files with 82 additions and 81 deletions

View File

@ -27,11 +27,15 @@ namespace osu.Game.Screens.OnlinePlay.Match.Components
protected abstract bool IsLoading { get; }
protected RoomSettingsOverlay()
{
RelativeSizeAxes = Axes.Both;
Masking = true;
}
[BackgroundDependencyLoader]
private void load()
{
Masking = true;
Add(Settings = CreateSettings());
}

View File

@ -64,6 +64,7 @@ namespace osu.Game.Screens.OnlinePlay.Match
private readonly Room room;
private ModSelectOverlay userModsSelectOverlay;
private RoomSettingsOverlay settingsOverlay;
protected RoomSubScreen(Room room)
{
@ -82,6 +83,8 @@ namespace osu.Game.Screens.OnlinePlay.Match
{
sampleStart = audio.Samples.Get(@"SongSelect/confirm-selection");
Drawable mainContent;
InternalChildren = new Drawable[]
{
BeatmapAvailabilityTracker,
@ -106,59 +109,62 @@ namespace osu.Game.Screens.OnlinePlay.Match
Horizontal = WaveOverlayContainer.WIDTH_PADDING,
Bottom = 30
},
// Main content
Child = new GridContainer
Children = new[]
{
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
mainContent = new GridContainer
{
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 10)
},
Content = new[]
{
new Drawable[]
RelativeSizeAxes = Axes.Both,
RowDimensions = new[]
{
CreateDrawableRoom(room).With(d => d.MatchingFilter = true),
new Dimension(GridSizeMode.AutoSize),
new Dimension(GridSizeMode.Absolute, 10)
},
null,
new Drawable[]
Content = new[]
{
new Container
new Drawable[]
{
RelativeSizeAxes = Axes.Both,
Children = new[]
CreateDrawableRoom(room).With(d => d.MatchingFilter = true),
},
null,
new Drawable[]
{
new Container
{
new Container
RelativeSizeAxes = Axes.Both,
Children = new[]
{
RelativeSizeAxes = Axes.Both,
Masking = true,
CornerRadius = 10,
Child = new Box
new Container
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex(@"3e3a44") // This is super temporary.
Masking = true,
CornerRadius = 10,
Child = new Box
{
RelativeSizeAxes = Axes.Both,
Colour = Color4Extensions.FromHex(@"3e3a44") // This is super temporary.
},
},
},
CreateMainContent(),
new Container
{
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Child = userModsSelectOverlay = new UserModSelectOverlay
CreateMainContent(),
new Container
{
SelectedMods = { BindTarget = UserMods },
IsValidMod = _ => false
}
},
Anchor = Anchor.BottomLeft,
Origin = Anchor.BottomLeft,
RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y,
Child = userModsSelectOverlay = new UserModSelectOverlay
{
SelectedMods = { BindTarget = UserMods },
IsValidMod = _ => false
}
},
}
}
}
}
}
}
}
},
settingsOverlay = CreateRoomSettingsOverlay()
},
},
},
// Footer
new[]
@ -168,6 +174,19 @@ namespace osu.Game.Screens.OnlinePlay.Match
}
}
};
if (room.RoomID.Value == null)
{
// A new room is being created.
// The main content should be hidden until the settings overlay is hidden, signaling the room is ready to be displayed.
mainContent.Hide();
settingsOverlay.State.BindValueChanged(visibility =>
{
if (visibility.NewValue == Visibility.Hidden)
mainContent.Show();
}, true);
}
}
protected override void LoadComplete()
@ -184,12 +203,24 @@ namespace osu.Game.Screens.OnlinePlay.Match
public override bool OnBackButton()
{
if (room.RoomID.Value == null)
{
// room has not been created yet; exit immediately.
return base.OnBackButton();
}
if (userModsSelectOverlay.State.Value == Visibility.Visible)
{
userModsSelectOverlay.Hide();
return true;
}
if (settingsOverlay.State.Value == Visibility.Visible)
{
settingsOverlay.Hide();
return true;
}
return base.OnBackButton();
}
@ -330,6 +361,8 @@ namespace osu.Game.Screens.OnlinePlay.Match
protected abstract Drawable CreateFooter();
protected abstract RoomSettingsOverlay CreateRoomSettingsOverlay();
private class UserModSelectOverlay : LocalPlayerModSelectOverlay
{
}

View File

@ -60,7 +60,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
private IDisposable readyClickOperation;
// private GridContainer mainContent;
private MultiplayerMatchSettingsOverlay settingsOverlay;
public MultiplayerMatchSubScreen(Room room)
: base(room)
@ -71,23 +70,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
Activity.Value = new UserActivity.InLobby(room);
}
[BackgroundDependencyLoader]
private void load()
{
if (client.Room == null)
{
// A new room is being created.
// The main content should be hidden until the settings overlay is hidden, signaling the room is ready to be displayed.
// mainContent.Hide();
settingsOverlay.State.BindValueChanged(visibility =>
{
// if (visibility.NewValue == Visibility.Hidden)
// mainContent.Show();
}, true);
}
}
protected override void LoadComplete()
{
base.LoadComplete();
@ -159,7 +141,7 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
{
new MultiplayerMatchHeader
{
OpenSettings = () => settingsOverlay.Show()
// OpenSettings = () => settingsOverlay.Show()
}
},
new Drawable[]
@ -280,11 +262,6 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
},
}
},
settingsOverlay = new MultiplayerMatchSettingsOverlay
{
RelativeSizeAxes = Axes.Both,
// State = { Value = client.Room == null ? Visibility.Visible : Visibility.Hidden }
}
}
};
@ -294,28 +271,13 @@ namespace osu.Game.Screens.OnlinePlay.Multiplayer
OnSpectateClick = onSpectateClick
};
protected override RoomSettingsOverlay CreateRoomSettingsOverlay() => new MultiplayerMatchSettingsOverlay();
[Resolved(canBeNull: true)]
private DialogOverlay dialogOverlay { get; set; }
private bool exitConfirmed;
public override bool OnBackButton()
{
if (client.Room == null)
{
// room has not been created yet; exit immediately.
return base.OnBackButton();
}
if (settingsOverlay.State.Value == Visibility.Visible)
{
settingsOverlay.Hide();
return true;
}
return base.OnBackButton();
}
public override bool OnExiting(IScreen next)
{
// the room may not be left immediately after a disconnection due to async flow,

View File

@ -303,5 +303,7 @@ namespace osu.Game.Screens.OnlinePlay.Playlists
protected override Drawable CreateMainContent() => Empty();
protected override Drawable CreateFooter() => Empty();
protected override RoomSettingsOverlay CreateRoomSettingsOverlay() => new PlaylistsRoomSettingsOverlay();
}
}