osu/osu.Game/Graphics/UserInterface/OsuContextMenu.cs

45 lines
1.4 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 09:19:50 +00:00
2018-11-20 07:51:59 +00:00
using osuTK.Graphics;
2018-04-13 09:19:50 +00:00
using osu.Framework.Allocation;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
2019-04-02 05:51:28 +00:00
using osu.Framework.Graphics.Effects;
2019-11-08 02:13:53 +00:00
using osu.Framework.Graphics.UserInterface;
2018-04-13 09:19:50 +00:00
namespace osu.Game.Graphics.UserInterface
{
public class OsuContextMenu : OsuMenu
{
private const int fade_duration = 250;
public OsuContextMenu()
: base(Direction.Vertical)
{
MaskingContainer.CornerRadius = 5;
MaskingContainer.EdgeEffect = new EdgeEffectParameters
{
Type = EdgeEffectType.Shadow,
Colour = Color4.Black.Opacity(0.1f),
Radius = 4,
};
ItemsContainer.Padding = new MarginPadding { Vertical = DrawableOsuMenuItem.MARGIN_VERTICAL };
MaxHeight = 250;
2018-04-13 09:19:50 +00:00
}
[BackgroundDependencyLoader]
private void load(OsuColour colours)
{
BackgroundColour = colours.ContextMenuGray;
}
protected override void AnimateOpen() => this.FadeIn(fade_duration, Easing.OutQuint);
protected override void AnimateClose() => this.FadeOut(fade_duration, Easing.OutQuint);
2019-11-08 02:13:53 +00:00
protected override Menu CreateSubMenu() => new OsuContextMenu();
2018-04-13 09:19:50 +00:00
}
}