1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Fix footer button hover sounds playing in unclickable area

This commit is contained in:
Joehu 2019-08-05 17:57:04 -07:00
parent bf0f6e1053
commit a7ac411c25
3 changed files with 8 additions and 7 deletions

View File

@ -94,7 +94,7 @@ namespace osu.Game.Screens.Select
buttons = new FillFlowContainer<FooterButton> buttons = new FillFlowContainer<FooterButton>
{ {
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
Spacing = new Vector2(0.2f, 0), Spacing = new Vector2(-FooterButton.SHEAR_WIDTH, 0),
AutoSizeAxes = Axes.Both, AutoSizeAxes = Axes.Both,
} }
} }

View File

@ -17,7 +17,9 @@ namespace osu.Game.Screens.Select
{ {
public class FooterButton : OsuClickableContainer public class FooterButton : OsuClickableContainer
{ {
private static readonly Vector2 shearing = new Vector2(0.15f, 0); public static readonly float SHEAR_WIDTH = 7.5f;
protected static readonly Vector2 SHEARING = new Vector2(SHEAR_WIDTH / Footer.HEIGHT, 0);
public string Text public string Text
{ {
@ -59,16 +61,16 @@ namespace osu.Game.Screens.Select
private readonly Box box; private readonly Box box;
private readonly Box light; private readonly Box light;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
public FooterButton() public FooterButton()
{ {
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
Shear = SHEARING;
Children = new Drawable[] Children = new Drawable[]
{ {
TextContainer = new Container TextContainer = new Container
{ {
Size = new Vector2(100, 50), Size = new Vector2(100 - SHEAR_WIDTH, 50),
Shear = -SHEARING,
Child = SpriteText = new OsuSpriteText Child = SpriteText = new OsuSpriteText
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
@ -78,14 +80,12 @@ namespace osu.Game.Screens.Select
box = new Box box = new Box
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Shear = shearing,
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
Colour = Color4.White, Colour = Color4.White,
Alpha = 0, Alpha = 0,
}, },
light = new Box light = new Box
{ {
Shear = shearing,
Height = 4, Height = 4,
EdgeSmoothness = new Vector2(2, 0), EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,

View File

@ -32,6 +32,7 @@ namespace osu.Game.Screens.Select
{ {
Anchor = Anchor.CentreLeft, Anchor = Anchor.CentreLeft,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
Shear = -SHEARING,
Child = modDisplay = new FooterModDisplay Child = modDisplay = new FooterModDisplay
{ {
DisplayUnrankedText = false, DisplayUnrankedText = false,