mirror of
https://github.com/ppy/osu.git
synced 2025-01-26 21:03:21 +08:00
Add TopLevelContent
layer for applying external transforms on footer buttons
This commit is contained in:
parent
820cfbcb00
commit
a2794922d5
@ -10,6 +10,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Testing;
|
using osu.Framework.Testing;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Rulesets.Osu.Mods;
|
using osu.Game.Rulesets.Osu.Mods;
|
||||||
using osu.Game.Screens.SelectV2.Footer;
|
using osu.Game.Screens.SelectV2.Footer;
|
||||||
@ -26,12 +27,12 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
|
|
||||||
public TestSceneScreenFooterButtonMods()
|
public TestSceneScreenFooterButtonMods()
|
||||||
{
|
{
|
||||||
Add(footerButtonMods = new TestScreenFooterButtonMods
|
Add(footerButtonMods = new TestScreenFooterButtonMods(new TestModSelectOverlay())
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.CentreLeft,
|
Origin = Anchor.CentreLeft,
|
||||||
X = -100,
|
|
||||||
Action = () => { },
|
Action = () => { },
|
||||||
|
X = -100,
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -112,9 +113,19 @@ namespace osu.Game.Tests.Visual.UserInterface
|
|||||||
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
|
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private partial class TestModSelectOverlay : UserModSelectOverlay
|
||||||
|
{
|
||||||
|
protected override bool ShowPresets => true;
|
||||||
|
}
|
||||||
|
|
||||||
private partial class TestScreenFooterButtonMods : ScreenFooterButtonMods
|
private partial class TestScreenFooterButtonMods : ScreenFooterButtonMods
|
||||||
{
|
{
|
||||||
public new OsuSpriteText MultiplierText => base.MultiplierText;
|
public new OsuSpriteText MultiplierText => base.MultiplierText;
|
||||||
|
|
||||||
|
public TestScreenFooterButtonMods(ModSelectOverlay overlay)
|
||||||
|
: base(overlay)
|
||||||
|
{
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -55,7 +55,7 @@ namespace osu.Game.Screens.Footer
|
|||||||
set => icon.Icon = value;
|
set => icon.Icon = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected LocalisableString Text
|
public LocalisableString Text
|
||||||
{
|
{
|
||||||
set => text.Text = value;
|
set => text.Text = value;
|
||||||
}
|
}
|
||||||
@ -69,11 +69,21 @@ namespace osu.Game.Screens.Footer
|
|||||||
private readonly Box glowBox;
|
private readonly Box glowBox;
|
||||||
private readonly Box flashLayer;
|
private readonly Box flashLayer;
|
||||||
|
|
||||||
public ScreenFooterButton()
|
public readonly Container TopLevelContent;
|
||||||
|
public readonly OverlayContainer? Overlay;
|
||||||
|
|
||||||
|
public ScreenFooterButton(OverlayContainer? overlay = null)
|
||||||
{
|
{
|
||||||
|
Overlay = overlay;
|
||||||
|
|
||||||
Size = new Vector2(BUTTON_WIDTH, BUTTON_HEIGHT);
|
Size = new Vector2(BUTTON_WIDTH, BUTTON_HEIGHT);
|
||||||
|
|
||||||
Child = new Container
|
Child = TopLevelContent = new Container
|
||||||
|
{
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new Container
|
||||||
{
|
{
|
||||||
EdgeEffect = new EdgeEffectParameters
|
EdgeEffect = new EdgeEffectParameters
|
||||||
{
|
{
|
||||||
@ -150,6 +160,8 @@ namespace osu.Game.Screens.Footer
|
|||||||
Alpha = 0,
|
Alpha = 0,
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
}
|
||||||
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -157,6 +169,9 @@ namespace osu.Game.Screens.Footer
|
|||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
|
|
||||||
|
if (Overlay != null)
|
||||||
|
OverlayState.BindTo(Overlay.State);
|
||||||
|
|
||||||
OverlayState.BindValueChanged(_ => updateDisplay());
|
OverlayState.BindValueChanged(_ => updateDisplay());
|
||||||
Enabled.BindValueChanged(_ => updateDisplay(), true);
|
Enabled.BindValueChanged(_ => updateDisplay(), true);
|
||||||
|
|
||||||
|
@ -20,6 +20,7 @@ using osu.Game.Graphics;
|
|||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
using osu.Game.Localisation;
|
using osu.Game.Localisation;
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
|
using osu.Game.Overlays.Mods;
|
||||||
using osu.Game.Rulesets.Mods;
|
using osu.Game.Rulesets.Mods;
|
||||||
using osu.Game.Screens.Footer;
|
using osu.Game.Screens.Footer;
|
||||||
using osu.Game.Screens.Play.HUD;
|
using osu.Game.Screens.Play.HUD;
|
||||||
@ -59,6 +60,11 @@ namespace osu.Game.Screens.SelectV2.Footer
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private OverlayColourProvider colourProvider { get; set; } = null!;
|
private OverlayColourProvider colourProvider { get; set; } = null!;
|
||||||
|
|
||||||
|
public ScreenFooterButtonMods(ModSelectOverlay overlay)
|
||||||
|
: base(overlay)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
@ -66,7 +72,7 @@ namespace osu.Game.Screens.SelectV2.Footer
|
|||||||
Icon = FontAwesome.Solid.ExchangeAlt;
|
Icon = FontAwesome.Solid.ExchangeAlt;
|
||||||
AccentColour = colours.Lime1;
|
AccentColour = colours.Lime1;
|
||||||
|
|
||||||
AddRange(new[]
|
TopLevelContent.AddRange(new[]
|
||||||
{
|
{
|
||||||
unrankedBadge = new UnrankedBadge(),
|
unrankedBadge = new UnrankedBadge(),
|
||||||
modDisplayBar = new Container
|
modDisplayBar = new Container
|
||||||
|
Loading…
Reference in New Issue
Block a user