Skip to content

Bring all new song select components together #32854

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 41 commits into
base: master
Choose a base branch
from

Conversation

frenzibyte
Copy link
Member

@frenzibyte frenzibyte commented Apr 18, 2025

Unlike in #32715, all functionality implemented to SongSelect has not been pushed here, as it increased the review overhead magnificently.

Below diff can be applied to test out song select with said functionality:

diff
diff --git a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs
index 9cb7d152de..aae6809235 100644
--- a/osu.Game/Screens/SelectV2/BeatmapCarousel.cs
+++ b/osu.Game/Screens/SelectV2/BeatmapCarousel.cs
@@ -22,6 +22,7 @@ namespace osu.Game.Screens.SelectV2
     [Cached]
     public partial class BeatmapCarousel : Carousel<BeatmapInfo>
     {
+        public Action<BeatmapInfo>? RequestSelectBeatmap { private get; init; }
         public Action<BeatmapInfo>? RequestPresentBeatmap { private get; init; }
 
         public const float SPACING = 3f;
@@ -160,6 +161,8 @@ protected override void HandleItemSelected(object? model)
                     if (containingGroup != null)
                         setExpandedGroup(containingGroup);
                     setExpandedSet(beatmapInfo);
+
+                    RequestSelectBeatmap?.Invoke(beatmapInfo);
                     break;
             }
         }
diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs
index 3144168712..c5971ed7f5 100644
--- a/osu.Game/Screens/SelectV2/SongSelect.cs
+++ b/osu.Game/Screens/SelectV2/SongSelect.cs
@@ -3,6 +3,7 @@
 
 using System.Collections.Generic;
 using osu.Framework.Allocation;
+using osu.Framework.Bindables;
 using osu.Framework.Extensions.Color4Extensions;
 using osu.Framework.Graphics;
 using osu.Framework.Graphics.Colour;
@@ -10,11 +11,13 @@
 using osu.Framework.Graphics.Cursor;
 using osu.Framework.Graphics.Shapes;
 using osu.Framework.Screens;
+using osu.Game.Beatmaps;
 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.Play;
 using osu.Game.Screens.Select;
 using osuTK;
 using osuTK.Graphics;
@@ -25,14 +28,16 @@ namespace osu.Game.Screens.SelectV2
     /// This screen is intended to house all components introduced in the new song select design to add transitions and examine the overall look.
     /// This will be gradually built upon and ultimately replace <see cref="Select.SongSelect"/> once everything is in place.
     /// </summary>
-    public abstract partial class SongSelect : OsuScreen
+    public abstract partial class SongSelect : ScreenWithBeatmapBackground
     {
         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;
+
+        public const double ENTER_DURATION = 600;
 
         private readonly ModSelectOverlay modSelectOverlay = new UserModSelectOverlay(OverlayColourScheme.Aquamarine)
         {
@@ -51,9 +56,19 @@ public abstract partial class SongSelect : OsuScreen
 
         public override bool ShowFooter => true;
 
+        [Resolved]
+        private BeatmapManager beatmaps { get; set; } = null!;
+
         [Resolved]
         private OsuLogo? logo { get; set; }
 
+        public override IReadOnlyList<ScreenFooterButton> CreateFooterButtons() => new ScreenFooterButton[]
+        {
+            new FooterButtonMods(modSelectOverlay) { Current = Mods },
+            new FooterButtonRandom(),
+            new FooterButtonOptions(),
+        };
+
         [BackgroundDependencyLoader]
         private void load()
         {
@@ -124,6 +139,7 @@ private void load()
                                                         {
                                                             BleedTop = FilterControl.HEIGHT_FROM_SCREEN_TOP + 5,
                                                             BleedBottom = ScreenFooter.HEIGHT + 5,
+                                                            RequestSelectBeatmap = b => Beatmap.Value = beatmaps.GetWorkingBeatmap(b),
                                                             RequestPresentBeatmap = _ => OnStart(),
                                                             RelativeSizeAxes = Axes.Both,
                                                         },
@@ -147,35 +163,41 @@ private void load()
             });
         }
 
-        public override IReadOnlyList<ScreenFooterButton> CreateFooterButtons() => new ScreenFooterButton[]
-        {
-            new FooterButtonMods(modSelectOverlay) { Current = Mods },
-            new FooterButtonRandom(),
-            new FooterButtonOptions(),
-        };
-
-        protected override void LoadComplete()
+        /// <summary>
+        /// Set the query to the search text box.
+        /// </summary>
+        /// <param name="query">The string to search.</param>
+        public void Search(string query)
         {
-            base.LoadComplete();
-
-            modSelectOverlay.State.BindValueChanged(v =>
+            carousel.Filter(new FilterCriteria
             {
-                logo?.ScaleTo(v.NewValue == Visibility.Visible ? 0f : logo_scale, 400, Easing.OutQuint)
-                    .FadeTo(v.NewValue == Visibility.Visible ? 0f : 1f, 200, Easing.OutQuint);
-            }, true);
+                // TODO: this should only set the text of the current criteria, not use a completely new criteria.
+                SearchText = query,
+            });
         }
 
+        /// <summary>
+        /// Called when a selection is made.
+        /// </summary>
+        /// <returns>If a resultant action occurred that takes the user away from SongSelect.</returns>
+        protected abstract bool OnStart();
+
         public override void OnEntering(ScreenTransitionEvent e)
         {
             base.OnEntering(e);
 
             this.FadeIn();
 
+            Beatmap.BindValueChanged(onBeatmapChanged, true);
+
             titleWedge.Show();
             detailsArea.Show();
             filterControl.Show();
 
+            modSelectOverlay.State.BindValueChanged(onModSelectStateChanged, true);
             modSelectOverlay.SelectedMods.BindTo(Mods);
+
+            updateScreenBackground();
         }
 
         public override void OnResuming(ScreenTransitionEvent e)
@@ -193,6 +215,8 @@ public override void OnResuming(ScreenTransitionEvent e)
             // required due to https://github.com/ppy/osu-framework/issues/3218
             modSelectOverlay.SelectedMods.Disabled = false;
             modSelectOverlay.SelectedMods.BindTo(Mods);
+
+            updateScreenBackground();
         }
 
         public override void OnSuspending(ScreenTransitionEvent e)
@@ -244,12 +268,6 @@ protected override void LogoArriving(OsuLogo logo, bool resuming)
             };
         }
 
-        /// <summary>
-        /// Called when a selection is made.
-        /// </summary>
-        /// <returns>If a resultant action occurred that takes the user away from SongSelect.</returns>
-        protected abstract bool OnStart();
-
         protected override void LogoSuspending(OsuLogo logo)
         {
             base.LogoSuspending(logo);
@@ -264,19 +282,32 @@ protected override void LogoExiting(OsuLogo logo)
             logo.FadeOut(120, Easing.Out);
         }
 
-        /// <summary>
-        /// Set the query to the search text box.
-        /// </summary>
-        /// <param name="query">The string to search.</param>
-        public void Search(string query)
+        private void onBeatmapChanged(ValueChangedEvent<WorkingBeatmap> b)
         {
-            carousel.Filter(new FilterCriteria
+            if (this.IsCurrentScreen())
+                updateScreenBackground();
+        }
+
+        private void updateScreenBackground()
+        {
+            ApplyToBackground(backgroundModeBeatmap =>
             {
-                // TODO: this should only set the text of the current criteria, not use a completely new criteria.
-                SearchText = query,
+                backgroundModeBeatmap.Beatmap = Beatmap.Value;
+                backgroundModeBeatmap.DimWhenUserSettingsIgnored.Value = 0.25f;
+                backgroundModeBeatmap.BlurAmount.Value = 0f;
+                backgroundModeBeatmap.IgnoreUserSettings.Value = true;
+                backgroundModeBeatmap.FadeColour(Color4.White, 250);
             });
         }
 
+        private void onModSelectStateChanged(ValueChangedEvent<Visibility> v)
+        {
+            if (v.NewValue == Visibility.Visible)
+                logo?.ScaleTo(0f, 400, Easing.OutQuint).FadeTo(0f, 200, Easing.OutQuint);
+            else
+                logo?.ScaleTo(logo_scale, 400, Easing.OutQuint).FadeTo(1f, 200, Easing.OutQuint);
+        }
+
         protected override void Update()
         {
             base.Update();

Preview:

CleanShot.2025-04-18.at.08.48.16-converted.mp4

@cyperdark
Copy link

cyperdark commented Apr 22, 2025

i don't know if it's right place to report, but scroll area for beatmap carousel is kinda far away on lower ui scalling, compare to current song select

1745311603_JarvYYYOQh.mp4
1745311903_ItScac8yCA.mp4

@peppy
Copy link
Member

peppy commented Apr 22, 2025

It's a valid concern. I'll add a mention in #32736.

@peppy peppy mentioned this pull request Apr 8, 2025
18 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants