Make ScreenFooterButtonMods share shear factor with base class

This commit is contained in:
Salman Ahmed 2024-05-16 05:30:19 +03:00
parent 9446f45acf
commit 7fce4cc494

View File

@ -33,12 +33,9 @@ namespace osu.Game.Screens.SelectV2.Footer
{ {
// todo: see https://github.com/ppy/osu-framework/issues/3271 // todo: see https://github.com/ppy/osu-framework/issues/3271
private const float torus_scale_factor = 1.2f; private const float torus_scale_factor = 1.2f;
private const float bar_shear_width = 7f;
private const float bar_height = 37f; private const float bar_height = 37f;
private const float mod_display_portion = 0.65f; private const float mod_display_portion = 0.65f;
private static readonly Vector2 bar_shear = new Vector2(bar_shear_width / bar_height, 0);
private readonly BindableWithCurrent<IReadOnlyList<Mod>> current = new BindableWithCurrent<IReadOnlyList<Mod>>(Array.Empty<Mod>()); private readonly BindableWithCurrent<IReadOnlyList<Mod>> current = new BindableWithCurrent<IReadOnlyList<Mod>>(Array.Empty<Mod>());
public Bindable<IReadOnlyList<Mod>> Current public Bindable<IReadOnlyList<Mod>> Current
@ -77,7 +74,7 @@ namespace osu.Game.Screens.SelectV2.Footer
Y = -5f, Y = -5f,
Depth = float.MaxValue, Depth = float.MaxValue,
Origin = Anchor.BottomLeft, Origin = Anchor.BottomLeft,
Shear = bar_shear, Shear = BUTTON_SHEAR,
CornerRadius = CORNER_RADIUS, CornerRadius = CORNER_RADIUS,
Size = new Vector2(BUTTON_WIDTH, bar_height), Size = new Vector2(BUTTON_WIDTH, bar_height),
Masking = true, Masking = true,
@ -107,7 +104,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Shear = -bar_shear, Shear = -BUTTON_SHEAR,
UseFullGlyphHeight = false, UseFullGlyphHeight = false,
Font = OsuFont.Torus.With(size: 14 * torus_scale_factor, weight: FontWeight.Bold) Font = OsuFont.Torus.With(size: 14 * torus_scale_factor, weight: FontWeight.Bold)
} }
@ -129,7 +126,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Shear = -bar_shear, Shear = -BUTTON_SHEAR,
Scale = new Vector2(0.6f), Scale = new Vector2(0.6f),
Current = { BindTarget = Current }, Current = { BindTarget = Current },
ExpansionMode = ExpansionMode.AlwaysContracted, ExpansionMode = ExpansionMode.AlwaysContracted,
@ -138,7 +135,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Shear = -bar_shear, Shear = -BUTTON_SHEAR,
Font = OsuFont.Torus.With(size: 14 * torus_scale_factor, weight: FontWeight.Bold), Font = OsuFont.Torus.With(size: 14 * torus_scale_factor, weight: FontWeight.Bold),
Mods = { BindTarget = Current }, Mods = { BindTarget = Current },
} }
@ -304,7 +301,7 @@ namespace osu.Game.Screens.SelectV2.Footer
Y = -5f; Y = -5f;
Depth = float.MaxValue; Depth = float.MaxValue;
Origin = Anchor.BottomLeft; Origin = Anchor.BottomLeft;
Shear = bar_shear; Shear = BUTTON_SHEAR;
CornerRadius = CORNER_RADIUS; CornerRadius = CORNER_RADIUS;
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;
Height = bar_height; Height = bar_height;
@ -328,7 +325,7 @@ namespace osu.Game.Screens.SelectV2.Footer
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.Centre, Origin = Anchor.Centre,
Shear = -bar_shear, Shear = -BUTTON_SHEAR,
Text = ModSelectOverlayStrings.Unranked.ToUpper(), Text = ModSelectOverlayStrings.Unranked.ToUpper(),
Margin = new MarginPadding { Horizontal = 15 }, Margin = new MarginPadding { Horizontal = 15 },
UseFullGlyphHeight = false, UseFullGlyphHeight = false,