1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-18 10:22:56 +08:00
osu-lazer/osu.Game/Overlays/SettingsOverlay.cs

78 lines
2.6 KiB
C#
Raw Normal View History

// 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.
2018-04-13 17:19:50 +08:00
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Overlays.Settings;
using osu.Game.Overlays.Settings.Sections;
using osuTK.Graphics;
using System.Collections.Generic;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Overlays
{
public class SettingsOverlay : SettingsPanel
2018-04-13 17:19:50 +08:00
{
private readonly KeyBindingPanel keyBindingPanel;
2018-04-13 17:19:50 +08:00
protected override IEnumerable<SettingsSection> CreateSections() => new SettingsSection[]
2018-04-13 17:19:50 +08:00
{
new GeneralSection(),
new GraphicsSection(),
new GameplaySection(),
new AudioSection(),
new SkinSection(),
new InputSection(keyBindingPanel),
new OnlineSection(),
new MaintenanceSection(),
new DebugSection(),
};
protected override Drawable CreateHeader() => new SettingsHeader("settings", "Change the way osu! behaves");
protected override Drawable CreateFooter() => new SettingsFooter();
public SettingsOverlay()
: base(true)
2018-04-13 17:19:50 +08:00
{
keyBindingPanel = new KeyBindingPanel
2018-04-13 17:19:50 +08:00
{
Depth = 1,
Anchor = Anchor.TopRight,
2018-04-13 17:19:50 +08:00
};
keyBindingPanel.StateChanged += keyBindingPanelStateChanged;
2018-04-13 17:19:50 +08:00
}
public override bool AcceptsFocus => keyBindingPanel.State != Visibility.Visible;
2018-04-13 17:19:50 +08:00
private void keyBindingPanelStateChanged(Visibility visibility)
2018-04-13 17:19:50 +08:00
{
switch (visibility)
{
case Visibility.Visible:
Background.FadeTo(0.9f, 300, Easing.OutQuint);
Sidebar?.FadeColour(Color4.DarkGray, 300, Easing.OutQuint);
2018-04-13 17:19:50 +08:00
SectionsContainer.FadeOut(300, Easing.OutQuint);
ContentContainer.MoveToX(-WIDTH, 500, Easing.OutQuint);
break;
2018-04-13 17:19:50 +08:00
case Visibility.Hidden:
Background.FadeTo(0.6f, 500, Easing.OutQuint);
Sidebar?.FadeColour(Color4.White, 300, Easing.OutQuint);
2018-04-13 17:19:50 +08:00
SectionsContainer.FadeIn(500, Easing.OutQuint);
ContentContainer.MoveToX(0, 500, Easing.OutQuint);
break;
}
2018-04-13 17:19:50 +08:00
}
protected override float ExpandedPosition => keyBindingPanel.State == Visibility.Visible ? -WIDTH : base.ExpandedPosition;
2018-04-13 17:19:50 +08:00
[BackgroundDependencyLoader]
private void load()
2018-04-13 17:19:50 +08:00
{
ContentContainer.Add(keyBindingPanel);
2018-04-13 17:19:50 +08:00
}
}
}