mirror of
https://github.com/ppy/osu.git
synced 2026-05-23 09:40:16 +08:00
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?
This commit is contained in:
@@ -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<GlobalAction> e)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user