1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 17:47:29 +08:00
osu-lazer/osu.Game/Screens/Select/FooterV2/FooterButtonOptionsV2.cs
2023-09-04 00:53:09 -07:00

58 lines
1.7 KiB
C#

// 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.Bindables;
using osu.Framework.Extensions;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Graphics.Sprites;
using osu.Framework.Graphics.UserInterface;
using osu.Game.Graphics;
using osu.Game.Input.Bindings;
namespace osu.Game.Screens.Select.FooterV2
{
public partial class FooterButtonOptionsV2 : FooterButtonV2, IHasPopover
{
public readonly BindableBool IsActive = new BindableBool();
[BackgroundDependencyLoader]
private void load(OsuColour colour)
{
Text = "Options";
Icon = FontAwesome.Solid.Cog;
AccentColour = colour.Purple1;
Hotkey = GlobalAction.ToggleBeatmapOptions;
Action = () => IsActive.Toggle();
}
protected override void LoadComplete()
{
base.LoadComplete();
IsActive.BindValueChanged(active =>
{
OverlayState.Value = active.NewValue ? Visibility.Visible : Visibility.Hidden;
});
OverlayState.BindValueChanged(state =>
{
switch (state.NewValue)
{
case Visibility.Hidden:
this.HidePopover();
break;
case Visibility.Visible:
this.ShowPopover();
break;
}
});
}
public Popover GetPopover() => new BeatmapOptionsPopover(this);
}
}