1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 15:17:27 +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.Osu;
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;
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 FooterButtonModsV2 modsButton = null!;
private ScreenFooterButtonRandom randomButton = null!;
private ScreenFooterButtonMods modsButton = null!;
private bool nextRandomCalled;
private bool previousRandomCalled;
@ -39,25 +40,25 @@ namespace osu.Game.Tests.Visual.SongSelect
nextRandomCalled = false;
previousRandomCalled = false;
FooterV2 footer;
ScreenFooter footer;
Children = new Drawable[]
{
new PopoverContainer
{
RelativeSizeAxes = Axes.Both,
Child = footer = new FooterV2(),
Child = footer = new ScreenFooter(),
},
overlay = new DummyOverlay()
};
footer.AddButton(modsButton = new FooterButtonModsV2 { Current = SelectedMods }, overlay);
footer.AddButton(randomButton = new FooterButtonRandomV2
footer.AddButton(modsButton = new ScreenFooterButtonMods { Current = SelectedMods }, overlay);
footer.AddButton(randomButton = new ScreenFooterButtonRandom
{
NextRandom = () => nextRandomCalled = true,
PreviousRandom = () => previousRandomCalled = true
});
footer.AddButton(new FooterButtonOptionsV2());
footer.AddButton(new ScreenFooterButtonOptions());
overlay.Hide();
});
@ -98,7 +99,7 @@ namespace osu.Game.Tests.Visual.SongSelect
{
AddStep("enable options", () =>
{
var optionsButton = this.ChildrenOfType<FooterButtonV2>().Last();
var optionsButton = this.ChildrenOfType<ScreenFooterButton>().Last();
optionsButton.Enabled.Value = true;
optionsButton.TriggerClick();
@ -108,7 +109,7 @@ namespace osu.Game.Tests.Visual.SongSelect
[Test]
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]

View File

@ -12,21 +12,21 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Rulesets.Osu.Mods;
using osu.Game.Screens.Select.FooterV2;
using osu.Game.Screens.SelectV2.Footer;
using osu.Game.Utils;
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]
private OverlayColourProvider colourProvider = new OverlayColourProvider(OverlayColourScheme.Aquamarine);
public TestSceneFooterButtonModsV2()
public TestSceneScreenFooterButtonMods()
{
Add(footerButtonMods = new TestFooterButtonModsV2
Add(footerButtonMods = new TestScreenFooterButtonMods
{
Anchor = Anchor.Centre,
Origin = Anchor.CentreLeft,
@ -97,9 +97,9 @@ namespace osu.Game.Tests.Visual.UserInterface
public void TestUnrankedBadge()
{
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>()));
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;
@ -112,7 +112,7 @@ namespace osu.Game.Tests.Visual.UserInterface
return expectedValue == footerButtonMods.MultiplierText.Current.Value;
}
private partial class TestFooterButtonModsV2 : FooterButtonModsV2
private partial class TestScreenFooterButtonMods : ScreenFooterButtonMods
{
public new OsuSpriteText MultiplierText => base.MultiplierText;
}

View File

@ -11,9 +11,9 @@ using osu.Game.Graphics.UserInterface;
using osu.Game.Overlays;
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.
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="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)
{
@ -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;
Height = height;
@ -66,7 +66,7 @@ namespace osu.Game.Screens.Select.FooterV2
RelativeSizeAxes = Axes.Both,
Colour = colourProvider.Background5
},
buttons = new FillFlowContainer<FooterButtonV2>
buttons = new FillFlowContainer<ScreenFooterButton>
{
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
Anchor = Anchor.BottomLeft,

View File

@ -21,9 +21,9 @@ using osu.Game.Overlays;
using osuTK;
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.
private const float shear_width = 13.5f;
@ -70,7 +70,7 @@ namespace osu.Game.Screens.Select.FooterV2
private readonly Box glowBox;
private readonly Box flashLayer;
public FooterButtonV2()
public ScreenFooterButton()
{
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.Localisation;
using osu.Game.Overlays;
using osu.Game.Screens.Select;
using osuTK;
using osuTK.Graphics;
using osuTK.Input;
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
{
private FillFlowContainer buttonFlow = null!;
private readonly FooterButtonOptionsV2 footerButton;
private readonly ScreenFooterButtonOptions footerButton;
private WorkingBeatmap beatmapWhenOpening = null!;
[Resolved]
private IBindable<WorkingBeatmap> beatmap { get; set; } = null!;
public BeatmapOptionsPopover(FooterButtonOptionsV2 footerButton)
public BeatmapOptionsPopover(ScreenFooterButtonOptions footerButton)
{
this.footerButton = footerButton;
}

View File

@ -21,14 +21,15 @@ using osu.Game.Graphics.Sprites;
using osu.Game.Localisation;
using osu.Game.Overlays;
using osu.Game.Rulesets.Mods;
using osu.Game.Screens.Footer;
using osu.Game.Screens.Play.HUD;
using osu.Game.Utils;
using osuTK;
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
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.Game.Graphics;
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]
private void load(OsuColour colour)

View File

@ -10,12 +10,13 @@ using osu.Framework.Input.Events;
using osu.Game.Graphics;
using osu.Game.Graphics.Sprites;
using osu.Game.Input.Bindings;
using osu.Game.Screens.Footer;
using osuTK;
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? PreviousRandom { get; set; }