2019-05-26 16:36:07 +00: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.
|
|
|
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
using osu.Framework.Graphics;
|
2019-12-08 18:51:25 +00:00
|
|
|
using osu.Framework.Graphics.Containers;
|
2019-05-26 16:36:07 +00:00
|
|
|
using osu.Framework.Graphics.Sprites;
|
|
|
|
using osu.Game.Graphics;
|
|
|
|
using osu.Game.Graphics.Sprites;
|
|
|
|
using osu.Game.Overlays.Settings;
|
|
|
|
using osuTK;
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays
|
|
|
|
{
|
|
|
|
public abstract class SettingsSubPanel : SettingsPanel
|
|
|
|
{
|
|
|
|
protected SettingsSubPanel()
|
|
|
|
: base(true)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
|
|
|
AddInternal(new BackButton
|
|
|
|
{
|
|
|
|
Anchor = Anchor.BottomLeft,
|
|
|
|
Origin = Anchor.BottomLeft,
|
|
|
|
Action = Hide
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
2019-06-27 04:16:16 +00:00
|
|
|
protected override bool DimMainContent => false; // dimming is handled by main overlay
|
|
|
|
|
2022-03-31 06:18:24 +00:00
|
|
|
public class BackButton : SidebarButton
|
2019-05-26 16:36:07 +00:00
|
|
|
{
|
2021-10-09 18:43:18 +00:00
|
|
|
private Container content;
|
|
|
|
|
2019-05-26 16:36:07 +00:00
|
|
|
[BackgroundDependencyLoader]
|
|
|
|
private void load()
|
|
|
|
{
|
2022-01-06 08:15:42 +00:00
|
|
|
Size = new Vector2(SettingsSidebar.DEFAULT_WIDTH);
|
2019-12-08 18:51:25 +00:00
|
|
|
|
|
|
|
AddRange(new Drawable[]
|
2019-05-26 16:36:07 +00:00
|
|
|
{
|
2021-10-09 18:43:18 +00:00
|
|
|
content = new Container
|
2019-05-26 16:36:07 +00:00
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Children = new Drawable[]
|
|
|
|
{
|
|
|
|
new SpriteIcon
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Size = new Vector2(15),
|
|
|
|
Shadow = true,
|
|
|
|
Icon = FontAwesome.Solid.ChevronLeft
|
|
|
|
},
|
|
|
|
new OsuSpriteText
|
|
|
|
{
|
|
|
|
Anchor = Anchor.Centre,
|
|
|
|
Origin = Anchor.Centre,
|
|
|
|
Y = 15,
|
|
|
|
Font = OsuFont.GetFont(size: 12, weight: FontWeight.Bold),
|
|
|
|
Text = @"back",
|
|
|
|
},
|
|
|
|
}
|
|
|
|
}
|
2019-12-08 18:51:25 +00:00
|
|
|
});
|
2019-05-26 16:36:07 +00:00
|
|
|
}
|
2021-10-10 02:55:45 +00:00
|
|
|
|
|
|
|
protected override void UpdateState()
|
|
|
|
{
|
|
|
|
content.FadeColour(IsHovered ? ColourProvider.Light1 : ColourProvider.Light3, FADE_DURATION, Easing.OutQuint);
|
|
|
|
}
|
2019-05-26 16:36:07 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|