From edf62baae85d46cf5fa14fe982274860d774d2d5 Mon Sep 17 00:00:00 2001 From: Dean Herbert Date: Wed, 11 Jun 2025 17:19:10 +0900 Subject: [PATCH] Add ability to reveal background when long pressing in empty space As touched on in https://github.com/ppy/osu/discussions/33624. Maybe fine as a bit of an easter egg? --- osu.Game/Screens/SelectV2/SongSelect.cs | 69 ++++++++++++++++++++++--- 1 file changed, 61 insertions(+), 8 deletions(-) diff --git a/osu.Game/Screens/SelectV2/SongSelect.cs b/osu.Game/Screens/SelectV2/SongSelect.cs index 59b196f700..6164f5b088 100644 --- a/osu.Game/Screens/SelectV2/SongSelect.cs +++ b/osu.Game/Screens/SelectV2/SongSelect.cs @@ -93,6 +93,7 @@ namespace osu.Game.Screens.SelectV2 private BeatmapDetailsArea detailsArea = null!; private FillFlowContainer wedgesContainer = null!; private Box rightGradientBackground = null!; + private Container mainContent = null!; private NoResultsPlaceholder noResultsPlaceholder = null!; @@ -130,14 +131,10 @@ namespace osu.Game.Screens.SelectV2 AddRangeInternal(new Drawable[] { new GlobalScrollAdjustsVolume(), - new Box - { - RelativeSizeAxes = Axes.Both, - Width = 0.6f, - Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0f)), - }, - new Container + mainContent = new Container { + Anchor = Anchor.Centre, + Origin = Anchor.Centre, RelativeSizeAxes = Axes.Both, Padding = new MarginPadding { Bottom = ScreenFooter.HEIGHT }, Child = new OsuContextMenuContainer @@ -148,6 +145,12 @@ namespace osu.Game.Screens.SelectV2 RelativeSizeAxes = Axes.Both, Children = new Drawable[] { + new Box + { + RelativeSizeAxes = Axes.Both, + Width = 0.6f, + Colour = ColourInfo.GradientHorizontal(Color4.Black.Opacity(0.3f), Color4.Black.Opacity(0f)), + }, new GridContainer // used for max width implementation { RelativeSizeAxes = Axes.Both, @@ -575,6 +578,8 @@ namespace osu.Game.Screens.SelectV2 private void onLeavingScreen() { + restoreBackground(); + modSelectOverlay.SelectedMods.UnbindFrom(Mods); modSelectOverlay.Beatmap.UnbindFrom(Beatmap); @@ -724,7 +729,55 @@ namespace osu.Game.Screens.SelectV2 #endregion - #region Hotkeys + #region Input + + private ScheduledDelegate? revealingBackground; + + protected override bool OnMouseDown(MouseDownEvent e) + { + // I don't know why this works but it does. + // If the carousel panels are hovered, hovered no longer contains the screen. + // Maybe there's a better way of doing this, but I couldn't immeidately find a good setup. + bool mouseDownPriority = GetContainingInputManager()!.HoveredDrawables.Contains(this); + + if (e.Button == MouseButton.Left && mouseDownPriority) + { + revealingBackground = Scheduler.AddDelayed(() => + { + mainContent.ResizeWidthTo(1.2f, 600, Easing.OutQuint); + mainContent.ScaleTo(1.2f, 600, Easing.OutQuint); + mainContent.FadeOut(200, Easing.OutQuint); + + Footer?.Hide(); + }, 200); + } + + return base.OnMouseDown(e); + } + + protected override void OnMouseUp(MouseUpEvent e) + { + restoreBackground(); + base.OnMouseUp(e); + } + + private void restoreBackground() + { + if (revealingBackground == null) + return; + + if (revealingBackground.State == ScheduledDelegate.RunState.Complete) + { + mainContent.ResizeWidthTo(1f, 500, Easing.OutQuint); + mainContent.ScaleTo(1, 500, Easing.OutQuint); + mainContent.FadeIn(500, Easing.OutQuint); + + Footer?.Show(); + } + + revealingBackground.Cancel(); + revealingBackground = null; + } public virtual bool OnPressed(KeyBindingPressEvent e) {