2017-06-12 17:56:07 +08:00
|
|
|
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using OpenTK.Graphics;
|
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Extensions.Color4Extensions;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.UserInterface
|
|
|
|
|
{
|
2017-08-28 13:42:52 +08:00
|
|
|
|
public class OsuContextMenu : OsuMenu
|
2017-06-12 17:56:07 +08:00
|
|
|
|
{
|
2017-08-25 14:10:12 +08:00
|
|
|
|
private const int fade_duration = 250;
|
2017-06-12 17:56:07 +08:00
|
|
|
|
|
2017-08-25 14:10:12 +08:00
|
|
|
|
public OsuContextMenu()
|
2017-09-04 08:10:04 +08:00
|
|
|
|
: base(Direction.Vertical)
|
2017-06-12 17:56:07 +08:00
|
|
|
|
{
|
2017-09-04 08:10:04 +08:00
|
|
|
|
MaskingContainer.CornerRadius = 5;
|
|
|
|
|
MaskingContainer.EdgeEffect = new EdgeEffectParameters
|
2017-08-25 14:10:12 +08:00
|
|
|
|
{
|
|
|
|
|
Type = EdgeEffectType.Shadow,
|
|
|
|
|
Colour = Color4.Black.Opacity(0.1f),
|
|
|
|
|
Radius = 4,
|
|
|
|
|
};
|
2017-09-04 08:10:04 +08:00
|
|
|
|
|
|
|
|
|
ItemsContainer.Padding = new MarginPadding { Vertical = DrawableOsuMenuItem.MARGIN_VERTICAL };
|
2017-08-25 14:10:12 +08: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);
|
2017-06-12 17:56:07 +08:00
|
|
|
|
}
|
|
|
|
|
}
|