From dc4b0f8df1735d06fc01fd1dfc9dd0cebad1f3ef Mon Sep 17 00:00:00 2001 From: Salman Alshamrani Date: Fri, 18 Apr 2025 06:05:23 -0400 Subject: [PATCH] Integrate all subcomponents with the main screen --- osu.Game/Screens/SelectV2/SongSelect.cs | 140 +++++++++++++++++++----- 1 file changed, 115 insertions(+), 25 deletions(-) diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index ca09b2a40a..3144168712 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -3,14 +3,21 @@ using System.Collections.Generic; using osu.Framework.Allocation; +using osu.Framework.Extensions.Color4Extensions; using osu.Framework.Graphics; +using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; +using osu.Framework.Graphics.Cursor; +using osu.Framework.Graphics.Shapes; using osu.Framework.Screens; +using osu.Game.Graphics.Containers; using osu.Game.Overlays; using osu.Game.Overlays.Mods; using osu.Game.Screens.Footer; using osu.Game.Screens.Menu; using osu.Game.Screens.Select; +using osuTK; +using osuTK.Graphics; namespace osu.Game.Screens.SelectV2 { @@ -21,12 +28,13 @@ namespace osu.Game.Screens.SelectV2 public abstract partial class SongSelect : OsuScreen { private const float logo_scale = 0.4f; + private const double fade_duration = 300; public const float WEDGE_CONTENT_MARGIN = CORNER_RADIUS_HIDE_OFFSET + OsuGame.SCREEN_EDGE_MARGIN; public const float CORNER_RADIUS_HIDE_OFFSET = 20f; public const float ENTER_DURATION = 600; - private readonly ModSelectOverlay modSelectOverlay = new ModSelectOverlay(OverlayColourScheme.Aquamarine) + private readonly ModSelectOverlay modSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Aquamarine) { ShowPresets = true, }; @@ -36,6 +44,11 @@ namespace osu.Game.Screens.SelectV2 private BeatmapCarousel carousel = null!; + private FilterControl filterControl = null!; + private BeatmapTitleWedge titleWedge = null!; + private BeatmapDetailsArea detailsArea = null!; + private FillFlowContainer wedgesContainer = null!; + public override bool ShowFooter => true; [Resolved] @@ -46,33 +59,89 @@ namespace osu.Game.Screens.SelectV2 { AddRangeInternal(new Drawable[] { - new GridContainer // used for max width implementation + new Box { - Anchor = Anchor.TopRight, - Origin = Anchor.TopRight, RelativeSizeAxes = Axes.Both, - ColumnDimensions = new[] + Width = 0.5f, + Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.5f), Color4.Black.Opacity(0f)), + }, + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding { Bottom = ScreenFooter.HEIGHT }, + Child = new PopoverContainer { - new Dimension(), - new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 750), - }, - Content = new[] - { - new[] + RelativeSizeAxes = Axes.Both, + Children = new Drawable[] { - Empty(), - new Container + new GridContainer // used for max width implementation { RelativeSizeAxes = Axes.Both, - Padding = new MarginPadding { Bottom = ScreenFooter.HEIGHT }, - Child = carousel = new BeatmapCarousel + ColumnDimensions = new[] { - RequestPresentBeatmap = _ => OnStart(), - RelativeSizeAxes = Axes.Both + new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 850), + new Dimension(), + new Dimension(GridSizeMode.Relative, 0.5f, maxSize: 750), }, + Content = new[] + { + new[] + { + wedgesContainer = new FillFlowContainer + { + RelativeSizeAxes = Axes.Both, + Margin = new MarginPadding + { + Top = -CORNER_RADIUS_HIDE_OFFSET, + Left = -CORNER_RADIUS_HIDE_OFFSET + }, + Spacing = new Vector2(0f, 4f), + Direction = FillDirection.Vertical, + Shear = OsuGame.SHEAR, + Children = new Drawable[] + { + new ShearAligningWrapper(titleWedge = new BeatmapTitleWedge()), + new ShearAligningWrapper(detailsArea = new BeatmapDetailsArea()), + }, + }, + Empty(), + new Container + { + RelativeSizeAxes = Axes.Both, + Children = new CompositeDrawable[] + { + new Container + { + RelativeSizeAxes = Axes.Both, + Padding = new MarginPadding + { + Top = FilterControl.HEIGHT_FROM_SCREEN_TOP + 5, + Bottom = 5, + }, + Children = new Drawable[] + { + carousel = new BeatmapCarousel + { + BleedTop = FilterControl.HEIGHT_FROM_SCREEN_TOP + 5, + BleedBottom = ScreenFooter.HEIGHT + 5, + RequestPresentBeatmap = _ => OnStart(), + RelativeSizeAxes = Axes.Both, + }, + } + }, + filterControl = new FilterControl + { + Anchor = Anchor.TopRight, + Origin = Anchor.TopRight, + RelativeSizeAxes = Axes.X, + }, + } + }, + }, + } }, } - } + }, }, modSelectOverlay, }); @@ -98,34 +167,44 @@ namespace osu.Game.Screens.SelectV2 public override void OnEntering(ScreenTransitionEvent e) { + base.OnEntering(e); + this.FadeIn(); + titleWedge.Show(); + detailsArea.Show(); + filterControl.Show(); + modSelectOverlay.SelectedMods.BindTo(Mods); - - base.OnEntering(e); } - private const double fade_duration = 300; - public override void OnResuming(ScreenTransitionEvent e) { + base.OnResuming(e); + this.FadeIn(fade_duration, Easing.OutQuint); carousel.VisuallyFocusSelected = false; + titleWedge.Show(); + detailsArea.Show(); + filterControl.Show(); + // required due to https://github.com/ppy/osu-framework/issues/3218 modSelectOverlay.SelectedMods.Disabled = false; modSelectOverlay.SelectedMods.BindTo(Mods); - - base.OnResuming(e); } public override void OnSuspending(ScreenTransitionEvent e) { - this.Delay(100).FadeOut(fade_duration, Easing.OutQuint); + this.FadeOut(fade_duration, Easing.OutQuint); modSelectOverlay.SelectedMods.UnbindFrom(Mods); + titleWedge.Hide(); + detailsArea.Hide(); + filterControl.Hide(); + carousel.VisuallyFocusSelected = true; base.OnSuspending(e); @@ -134,6 +213,11 @@ namespace osu.Game.Screens.SelectV2 public override bool OnExiting(ScreenExitEvent e) { this.FadeOut(fade_duration, Easing.OutQuint); + + titleWedge.Hide(); + detailsArea.Hide(); + filterControl.Hide(); + return base.OnExiting(e); } @@ -192,5 +276,11 @@ namespace osu.Game.Screens.SelectV2 SearchText = query, }); } + + protected override void Update() + { + base.Update(); + detailsArea.Height = wedgesContainer.DrawHeight - titleWedge.LayoutSize.Y - 4; + } } }