Fix footer button hover sounds playing in unclickable area (#5612)

Fix footer button hover sounds playing in unclickable area

Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
Dean Herbert 2019-08-07 12:34:09 +09:00 committed by GitHub
commit 1bafde6d47
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 16 additions and 15 deletions

View File

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

View File

@ -17,7 +17,9 @@ namespace osu.Game.Screens.Select
{
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 SHEAR = new Vector2(SHEAR_WIDTH / Footer.HEIGHT, 0);
public string Text
{
@ -59,37 +61,35 @@ namespace osu.Game.Screens.Select
private readonly Box box;
private readonly Box light;
public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => box.ReceivePositionalInputAt(screenSpacePos);
public FooterButton()
{
AutoSizeAxes = Axes.Both;
Shear = SHEAR;
Children = new Drawable[]
{
TextContainer = new Container
{
Size = new Vector2(100, 50),
Child = SpriteText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
},
box = new Box
{
RelativeSizeAxes = Axes.Both,
Shear = shearing,
EdgeSmoothness = new Vector2(2, 0),
Colour = Color4.White,
Alpha = 0,
},
light = new Box
{
Shear = shearing,
Height = 4,
EdgeSmoothness = new Vector2(2, 0),
RelativeSizeAxes = Axes.X,
},
TextContainer = new Container
{
Size = new Vector2(100 - SHEAR_WIDTH, 50),
Shear = -SHEAR,
Child = SpriteText = new OsuSpriteText
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
}
},
};
}

View File

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