diff --git a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs index c7889134bb..6579e8109c 100644 --- a/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs +++ b/osu.Desktop.VisualTests/Tests/TestCaseMenuButtonSystem.cs @@ -2,7 +2,10 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework.GameModes.Testing; +using osu.Framework.Graphics.Colour; +using osu.Framework.Graphics.Sprites; using osu.Game.Screens.Menu; +using OpenTK.Graphics; namespace osu.Desktop.VisualTests.Tests { @@ -15,6 +18,11 @@ namespace osu.Desktop.VisualTests.Tests { base.Reset(); + Add(new Box + { + ColourInfo = ColourInfo.GradientVertical(Color4.Gray, Color4.WhiteSmoke), + RelativeSizeAxes = Framework.Graphics.Axes.Both, + }); Add(new ButtonSystem()); } } diff --git a/osu.Game/Screens/Menu/Button.cs b/osu.Game/Screens/Menu/Button.cs index 37bcc89a9a..f0de6e7f74 100644 --- a/osu.Game/Screens/Menu/Button.cs +++ b/osu.Game/Screens/Menu/Button.cs @@ -19,7 +19,7 @@ namespace osu.Game.Screens.Menu public class Button : Container, IStateful { private Container iconText; - private Box box; + private Container box; private Color4 colour; private TextAwesome icon; private string internalName; @@ -51,15 +51,31 @@ namespace osu.Game.Screens.Menu Children = new Drawable[] { - box = new Box + box = new Container { + Masking = true, + EdgeEffect = new EdgeEffect + { + Type = EdgeEffectType.Shadow, + Colour = new Color4(0, 0, 0, 0.2f), + Roundness = 5, + Radius = 8, + }, Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = colour, Scale = new Vector2(0, 1), Size = boxSize, Shear = new Vector2(ButtonSystem.wedge_width / boxSize.Y, 0), - EdgeSmoothness = new Vector2(2, 0), + + Children = new Drawable[] + { + new Box + { + EdgeSmoothness = new Vector2(2, 0), + RelativeSizeAxes = Axes.Both, + }, + } }, iconText = new Container { diff --git a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs index fc72365812..7a194d1d07 100644 --- a/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs +++ b/osu.Game/Screens/Menu/FlowContainerWithOrigin.cs @@ -1,6 +1,8 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using OpenTK; +using System.Collections.Generic; +using System.Linq; namespace osu.Game.Screens.Menu { @@ -15,6 +17,10 @@ namespace osu.Game.Screens.Menu /// public Drawable CentreTarget; + protected override IComparer DepthComparer => new ReverseDepthComparer(); + + protected override IEnumerable SortedChildren => base.SortedChildren.Reverse(); + public override Anchor Origin => Anchor.Custom; public override Vector2 OriginPosition