mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 16:47:46 +08:00
Add new footer back button
This commit is contained in:
parent
266f080362
commit
7e8d5a5b0a
64
osu.Game/Screens/Footer/ScreenBackButton.cs
Normal file
64
osu.Game/Screens/Footer/ScreenBackButton.cs
Normal file
@ -0,0 +1,64 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics;
|
||||||
|
using osu.Game.Graphics.Sprites;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
|
using osu.Game.Localisation;
|
||||||
|
using osuTK;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
|
namespace osu.Game.Screens.Footer
|
||||||
|
{
|
||||||
|
public partial class ScreenBackButton : ShearedButton
|
||||||
|
{
|
||||||
|
// todo: see https://github.com/ppy/osu-framework/issues/3271
|
||||||
|
private const float torus_scale_factor = 1.2f;
|
||||||
|
|
||||||
|
public const float BUTTON_WIDTH = 240;
|
||||||
|
|
||||||
|
public ScreenBackButton()
|
||||||
|
: base(BUTTON_WIDTH, 70)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
[BackgroundDependencyLoader]
|
||||||
|
private void load()
|
||||||
|
{
|
||||||
|
ButtonContent.Child = new FillFlowContainer
|
||||||
|
{
|
||||||
|
X = -10f,
|
||||||
|
RelativeSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Horizontal,
|
||||||
|
Spacing = new Vector2(20f, 0f),
|
||||||
|
Children = new Drawable[]
|
||||||
|
{
|
||||||
|
new SpriteIcon
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Size = new Vector2(20f),
|
||||||
|
Icon = FontAwesome.Solid.ChevronLeft,
|
||||||
|
},
|
||||||
|
new OsuSpriteText
|
||||||
|
{
|
||||||
|
Anchor = Anchor.Centre,
|
||||||
|
Origin = Anchor.Centre,
|
||||||
|
Font = OsuFont.TorusAlternate.With(size: 20 * torus_scale_factor),
|
||||||
|
Text = CommonStrings.Back,
|
||||||
|
UseFullGlyphHeight = false,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
DarkerColour = Color4Extensions.FromHex("#DE31AE");
|
||||||
|
LighterColour = Color4Extensions.FromHex("#FF86DD");
|
||||||
|
TextColour = Color4.White;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -7,7 +7,6 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
using osu.Game.Overlays;
|
using osu.Game.Overlays;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
|
|
||||||
@ -15,9 +14,8 @@ namespace osu.Game.Screens.Footer
|
|||||||
{
|
{
|
||||||
public partial class ScreenFooter : 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 = 60;
|
||||||
private const int height = 50;
|
private const int padding = 60;
|
||||||
private const int padding = 80;
|
|
||||||
|
|
||||||
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
private readonly List<OverlayContainer> overlays = new List<OverlayContainer>();
|
||||||
|
|
||||||
@ -68,13 +66,20 @@ namespace osu.Game.Screens.Footer
|
|||||||
},
|
},
|
||||||
buttons = new FillFlowContainer<ScreenFooterButton>
|
buttons = new FillFlowContainer<ScreenFooterButton>
|
||||||
{
|
{
|
||||||
Position = new Vector2(TwoLayerButton.SIZE_EXTENDED.X + padding, 10),
|
Position = new Vector2(ScreenBackButton.BUTTON_WIDTH + padding, 10),
|
||||||
Anchor = Anchor.BottomLeft,
|
Anchor = Anchor.BottomLeft,
|
||||||
Origin = Anchor.BottomLeft,
|
Origin = Anchor.BottomLeft,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
Spacing = new Vector2(7, 0),
|
Spacing = new Vector2(7, 0),
|
||||||
AutoSizeAxes = Axes.Both
|
AutoSizeAxes = Axes.Both
|
||||||
}
|
},
|
||||||
|
new ScreenBackButton
|
||||||
|
{
|
||||||
|
Margin = new MarginPadding { Bottom = 10f, Left = 12f },
|
||||||
|
Anchor = Anchor.BottomLeft,
|
||||||
|
Origin = Anchor.BottomLeft,
|
||||||
|
Action = () => { },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user