2022-12-01 18:57:50 +08:00
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
2022-12-01 20:13:37 +08:00
|
|
|
using System.Collections.Generic;
|
2022-12-01 18:57:50 +08:00
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
using osu.Framework.Graphics.Shapes;
|
|
|
|
using osu.Game.Graphics;
|
2022-12-01 20:13:37 +08:00
|
|
|
using osu.Game.Graphics.UserInterface;
|
2023-02-14 05:07:09 +08:00
|
|
|
using osu.Game.Overlays;
|
2022-12-01 20:13:37 +08:00
|
|
|
using osuTK;
|
2022-12-01 18:57:50 +08:00
|
|
|
|
|
|
|
namespace osu.Game.Screens.Select.FooterV2
|
|
|
|
{
|
2022-12-19 18:30:23 +08:00
|
|
|
public partial class FooterV2 : InputBlockingContainer
|
2022-12-01 18:57:50 +08:00
|
|
|
{
|
|
|
|
//Should be 60, setting to 50 for now for the sake of matching the current BackButton height.
|
|
|
|
private const int height = 50;
|
2022-12-01 20:13:37 +08:00
|
|
|
private const int padding = 80;
|
|
|
|
|
|
|
|
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
|
|
|
|
2022-12-19 23:35:20 +08:00
|
|
|
/// <param name="button">The button to be added.</param>
|
|
|
|
/// <param name="overlay">The <see cref="OverlayContainer"/> to be toggled by this button.</param>
|
2022-12-01 20:13:37 +08:00
|
|
|
public void AddButton(FooterButtonV2 button, OverlayContainer? overlay = null)
|
|
|
|
{
|
|
|
|
if (overlay != null)
|
|
|
|
{
|
|
|
|
overlays.Add(overlay);
|
|
|
|
button.Action = () => showOverlay(overlay);
|
2022-12-03 01:44:21 +08:00
|
|
|
button.OverlayState.BindTo(overlay.State);
|
2022-12-01 20:13:37 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
buttons.Add(button);
|
|
|
|
}
|
|
|
|
|
|
|
|
private void showOverlay(OverlayContainer overlay)
|
|
|
|
{
|
|
|
|
foreach (var o in overlays)
|
|
|
|
{
|
|
|
|
if (o == overlay)
|
|
|
|
o.ToggleVisibility();
|
|
|
|
else
|
|
|
|
o.Hide();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
private FillFlowContainer<FooterButtonV2> buttons = null!;
|
2022-12-01 18:57:50 +08:00
|
|
|
|
2023-09-04 12:49:29 +08:00
|
|
|
public FooterV2()
|
2022-12-01 18:57:50 +08:00
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
Height = height;
|
2023-09-04 12:49:29 +08:00
|
|
|
Anchor = Anchor.BottomLeft;
|
|
|
|
Origin = Anchor.BottomLeft;
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load(OverlayColourProvider colourProvider)
|
|
|
|
{
|
2022-12-01 18:57:50 +08:00
|
|
|
InternalChildren = new Drawable[]
|
|
|
|
{
|
|
|
|
new Box
|
|
|
|
{
|
|
|
|
RelativeSizeAxes = Axes.Both,
|
2023-02-14 05:07:09 +08:00
|
|
|
Colour = colourProvider.Background5
|
2022-12-01 20:13:37 +08:00
|
|
|
},
|
2023-02-14 05:07:09 +08:00
|
|
|
buttons = new FillFlowContainer<FooterButtonV2>
|
2022-12-01 20:13:37 +08:00
|
|
|
{
|
2023-02-14 05:07:09 +08:00
|
|
|
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
|
2022-12-01 20:13:37 +08:00
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
Direction = FillDirection.Horizontal,
|
2023-02-14 05:07:09 +08:00
|
|
|
Spacing = new Vector2(-FooterButtonV2.SHEAR_WIDTH + 7, 0),
|
|
|
|
AutoSizeAxes = Axes.Both
|
2022-12-01 18:57:50 +08:00
|
|
|
}
|
|
|
|
};
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|