osu/osu.Game/Graphics/UserInterface/OsuMenu.cs

33 lines
1.0 KiB
C#
Raw Normal View History

2017-03-21 22:51:26 +00: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;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface
{
public class OsuMenu : Menu
{
public OsuMenu()
{
CornerRadius = 4;
2017-03-21 23:55:47 +00:00
Background.Colour = Color4.Black.Opacity(0.5f);
2017-03-21 22:51:26 +00:00
ItemsContainer.Padding = new MarginPadding(5);
}
2017-07-22 18:50:25 +00:00
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
2017-03-21 22:51:26 +00:00
2017-07-22 18:50:25 +00:00
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
2017-03-21 22:51:26 +00:00
protected override void UpdateContentHeight()
{
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
2017-07-22 18:50:25 +00:00
this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, Easing.OutQuint);
2017-03-21 22:51:26 +00:00
}
}
}