1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-15 01:23:44 +08:00

Rename and move footer classes to appropriate places

This commit is contained in:
Salman Ahmed 2024-05-16 04:36:14 +03:00
parent a3960bf715
commit 21f5d891bb
8 changed files with 43 additions and 38 deletions

View File

@ -15,15 +15,16 @@ using osu.Game.Overlays.Mods;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu; using osu.Game.Rulesets.Osu;
using osu.Game.Rulesets.Osu.Mods; using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.FooterV2; using osu.Game.Screens.Footer;
using osu.Game.Screens.SelectV2.Footer;
using osuTK.Input; using osuTK.Input;
namespace osu.Game.Tests.Visual.SongSelect namespace osu.Game.Tests.Visual.UserInterface
{ {
public partial class TestSceneSongSelectFooterV2 : OsuManualInputManagerTestScene public partial class TestSceneScreenFooter : OsuManualInputManagerTestScene
{ {
private FooterButtonRandomV2 randomButton = null!; private ScreenFooterButtonRandom randomButton = null!;
private FooterButtonModsV2 modsButton = null!; private ScreenFooterButtonMods modsButton = null!;
private bool nextRandomCalled; private bool nextRandomCalled;
private bool previousRandomCalled; private bool previousRandomCalled;
@ -39,25 +40,25 @@ namespace osu.Game.Tests.Visual.SongSelect
nextRandomCalled = false; nextRandomCalled = false;
previousRandomCalled = false; previousRandomCalled = false;
FooterV2 footer; ScreenFooter footer;
Children = new Drawable[] Children = new Drawable[]
{ {
new PopoverContainer new PopoverContainer
{ {
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Child = footer = new FooterV2(), Child = footer = new ScreenFooter(),
}, },
overlay = new DummyOverlay() overlay = new DummyOverlay()
}; };
footer.AddButton(modsButton = new FooterButtonModsV2 { Current = SelectedMods }, overlay); footer.AddButton(modsButton = new ScreenFooterButtonMods { Current = SelectedMods }, overlay);
footer.AddButton(randomButton = new FooterButtonRandomV2 footer.AddButton(randomButton = new ScreenFooterButtonRandom
{ {
NextRandom = () => nextRandomCalled = true, NextRandom = () => nextRandomCalled = true,
PreviousRandom = () => previousRandomCalled = true PreviousRandom = () => previousRandomCalled = true
}); });
footer.AddButton(new FooterButtonOptionsV2()); footer.AddButton(new ScreenFooterButtonOptions());
overlay.Hide(); overlay.Hide();
}); });
@ -98,7 +99,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{ {
AddStep("enable options", () => AddStep("enable options", () =>
{ {
var optionsButton = this.ChildrenOfType<FooterButtonV2>().Last(); var optionsButton = this.ChildrenOfType<ScreenFooterButton>().Last();
optionsButton.Enabled.Value = true; optionsButton.Enabled.Value = true;
optionsButton.TriggerClick(); optionsButton.TriggerClick();
@ -108,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test] [Test]
public void TestState() public void TestState()
{ {
AddToggleStep("set options enabled state", state => this.ChildrenOfType<FooterButtonV2>().Last().Enabled.Value = state); AddToggleStep("set options enabled state", state => this.ChildrenOfType<ScreenFooterButton>().Last().Enabled.Value = state);
} }
[Test] [Test]

View File

@ -12,21 +12,21 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays; using osu.Game.Overlays;
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.Select.FooterV2; using osu.Game.Screens.SelectV2.Footer;
using osu.Game.Utils; using osu.Game.Utils;
namespace osu.Game.Tests.Visual.UserInterface namespace osu.Game.Tests.Visual.UserInterface
{ {
public partial class TestSceneFooterButtonModsV2 : OsuTestScene public partial class TestSceneScreenFooterButtonMods : OsuTestScene
{ {
private readonly TestFooterButtonModsV2 footerButtonMods; private readonly TestScreenFooterButtonMods footerButtonMods;
[Cached] [Cached]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine); private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
public TestSceneFooterButtonModsV2() public TestSceneScreenFooterButtonMods()
{ {
Add(footerButtonMods = new TestFooterButtonModsV2 Add(footerButtonMods = new TestScreenFooterButtonMods
{ {
Anchor = Anchor.Centre, Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft, Origin = Anchor.CentreLeft,
@ -97,9 +97,9 @@ namespace osu.Game.Tests.Visual.UserInterface
public void TestUnrankedBadge() public void TestUnrankedBadge()
{ {
AddStep(@"Add unranked mod", () => changeMods(new[] { new OsuModDeflate() })); AddStep(@"Add unranked mod", () => changeMods(new[] { new OsuModDeflate() }));
AddUntilStep("Unranked badge shown", () => footerButtonMods.ChildrenOfType<FooterButtonModsV2.UnrankedBadge>().Single().Alpha == 1); AddUntilStep("Unranked badge shown", () => footerButtonMods.ChildrenOfType<ScreenFooterButtonMods.UnrankedBadge>().Single().Alpha == 1);
AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>())); AddStep(@"Clear selected mod", () => changeMods(Array.Empty<Mod>()));
AddUntilStep("Unranked badge not shown", () => footerButtonMods.ChildrenOfType<FooterButtonModsV2.UnrankedBadge>().Single().Alpha == 0); AddUntilStep("Unranked badge not shown", () => footerButtonMods.ChildrenOfType<ScreenFooterButtonMods.UnrankedBadge>().Single().Alpha == 0);
} }
private void changeMods(IReadOnlyList<Mod> mods) => footerButtonMods.Current.Value = mods; private void changeMods(IReadOnlyList<Mod> mods) => footerButtonMods.Current.Value = mods;
@ -112,7 +112,7 @@ namespace osu.Game.Tests.Visual.UserInterface
return expectedValue == footerButtonMods.MultiplierText.Current.Value; return expectedValue == footerButtonMods.MultiplierText.Current.Value;
} }
private partial class TestFooterButtonModsV2 : FooterButtonModsV2 private partial class TestScreenFooterButtonMods : ScreenFooterButtonMods
{ {
public new OsuSpriteText MultiplierText => base.MultiplierText; public new OsuSpriteText MultiplierText => base.MultiplierText;
} }

View File

@ -11,9 +11,9 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays; using osu.Game.Overlays;
using osuTK; using osuTK;
namespace osu.Game.Screens.Select.FooterV2 namespace osu.Game.Screens.Footer
{ {
public partial class FooterV2 : InputBlockingContainer public partial class ScreenFooter : InputBlockingContainer
{ {
//Should be 60, setting to 50 for now for the sake of matching the current BackButton height. //Should be 60, setting to 50 for now for the sake of matching the current BackButton height.
private const int height = 50; private const int height = 50;
@ -23,7 +23,7 @@ namespace osu.Game.Screens.Select.FooterV2
/// <param name="button">The button to be added.</param> /// <param name="button">The button to be added.</param>
/// <param name="overlay">The <see cref="OverlayContainer"/> to be toggled by this button.</param> /// <param name="overlay">The <see cref="OverlayContainer"/> to be toggled by this button.</param>
public void AddButton(FooterButtonV2 button, OverlayContainer? overlay = null) public void AddButton(ScreenFooterButton button, OverlayContainer? overlay = null)
{ {
if (overlay != null) if (overlay != null)
{ {
@ -46,9 +46,9 @@ namespace osu.Game.Screens.Select.FooterV2
} }
} }
private FillFlowContainer<FooterButtonV2> buttons = null!; private FillFlowContainer<ScreenFooterButton> buttons = null!;
public FooterV2() public ScreenFooter()
{ {
RelativeSizeAxes = Axes.X; RelativeSizeAxes = Axes.X;
Height = height; Height = height;
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select.FooterV2
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5 Colour = colourProvider.Background5
}, },
buttons = new FillFlowContainer<FooterButtonV2> buttons = new FillFlowContainer<ScreenFooterButton>
{ {
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10), Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
Anchor = Anchor.BottomLeft, Anchor = Anchor.BottomLeft,

View File

@ -21,9 +21,9 @@ using osu.Game.Overlays;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Screens.Select.FooterV2 namespace osu.Game.Screens.Footer
{ {
public partial class FooterButtonV2 : OsuClickableContainer, IKeyBindingHandler<GlobalAction> public partial class ScreenFooterButton : OsuClickableContainer, IKeyBindingHandler<GlobalAction>
{ {
// This should be 12 by design, but an extra allowance is added due to the corner radius specification. // This should be 12 by design, but an extra allowance is added due to the corner radius specification.
private const float shear_width = 13.5f; private const float shear_width = 13.5f;
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.FooterV2
private readonly Box glowBox; private readonly Box glowBox;
private readonly Box flashLayer; private readonly Box flashLayer;
public FooterButtonV2() public ScreenFooterButton()
{ {
Size = new Vector2(BUTTON_WIDTH, BUTTON_HEIGHT); Size = new Vector2(BUTTON_WIDTH, BUTTON_HEIGHT);

View File

@ -20,24 +20,25 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Graphics.UserInterfaceV2; using osu.Game.Graphics.UserInterfaceV2;
using osu.Game.Localisation; using osu.Game.Localisation;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Screens.Select;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
using osuTK.Input; using osuTK.Input;
using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings; using WebCommonStrings = osu.Game.Resources.Localisation.Web.CommonStrings;
namespace osu.Game.Screens.Select.FooterV2 namespace osu.Game.Screens.SelectV2.Footer
{ {
public partial class BeatmapOptionsPopover : OsuPopover public partial class BeatmapOptionsPopover : OsuPopover
{ {
private FillFlowContainer buttonFlow = null!; private FillFlowContainer buttonFlow = null!;
private readonly FooterButtonOptionsV2 footerButton; private readonly ScreenFooterButtonOptions footerButton;
private WorkingBeatmap beatmapWhenOpening = null!; private WorkingBeatmap beatmapWhenOpening = null!;
[Resolved] [Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!; private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
public BeatmapOptionsPopover(FooterButtonOptionsV2 footerButton) public BeatmapOptionsPopover(ScreenFooterButtonOptions footerButton)
{ {
this.footerButton = footerButton; this.footerButton = footerButton;
} }

View File

@ -21,14 +21,15 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Localisation; using osu.Game.Localisation;
using osu.Game.Overlays; using osu.Game.Overlays;
using osu.Game.Rulesets.Mods; using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Footer;
using osu.Game.Screens.Play.HUD; using osu.Game.Screens.Play.HUD;
using osu.Game.Utils; using osu.Game.Utils;
using osuTK; using osuTK;
using osuTK.Graphics; using osuTK.Graphics;
namespace osu.Game.Screens.Select.FooterV2 namespace osu.Game.Screens.SelectV2.Footer
{ {
public partial class FooterButtonModsV2 : FooterButtonV2, IHasCurrentValue<IReadOnlyList<Mod>> public partial class ScreenFooterButtonMods : ScreenFooterButton, IHasCurrentValue<IReadOnlyList<Mod>>
{ {
// 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;

View File

@ -8,10 +8,11 @@ using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface; using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Screens.Footer;
namespace osu.Game.Screens.Select.FooterV2 namespace osu.Game.Screens.SelectV2.Footer
{ {
public partial class FooterButtonOptionsV2 : FooterButtonV2, IHasPopover public partial class ScreenFooterButtonOptions : ScreenFooterButton, IHasPopover
{ {
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(OsuColour colour) private void load(OsuColour colour)

View File

@ -10,12 +10,13 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics; using osu.Game.Graphics;
using osu.Game.Graphics.Sprites; using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings; using osu.Game.Input.Bindings;
using osu.Game.Screens.Footer;
using osuTK; using osuTK;
using osuTK.Input; using osuTK.Input;
namespace osu.Game.Screens.Select.FooterV2 namespace osu.Game.Screens.SelectV2.Footer
{ {
public partial class FooterButtonRandomV2 : FooterButtonV2 public partial class ScreenFooterButtonRandom : ScreenFooterButton
{ {
public Action? NextRandom { get; set; } public Action? NextRandom { get; set; }
public Action? PreviousRandom { get; set; } public Action? PreviousRandom { get; set; }