1
0
mirror of https://github.com/ppy/osu.git synced 2026-05-18 18:29:58 +08:00

Integrate all subcomponents with the main screen

This commit is contained in:
Salman Alshamrani
2025-04-18 06:05:23 -04:00
committed by Dean Herbert
Unverified
parent 437b1fa70f
commit dc4b0f8df1
+115 -25
View File
@@ -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;
}
}
}