1
0
mirror of https://github.com/ppy/osu.git synced 2024-12-15 13:22:55 +08:00

Update OsuMenu in line with framework.

This commit is contained in:
smoogipooo 2017-08-25 15:09:07 +09:00
parent 67513177e6
commit 06c392d6f2
2 changed files with 18 additions and 7 deletions

@ -1 +1 @@
Subproject commit da5fbf8c580b079671298f6da54be10a00bf434c
Subproject commit 5a189d1050579b217bfe6b6c17c3ee6d6ef9c839

View File

@ -5,28 +5,39 @@ using OpenTK;
using OpenTK.Graphics;
using osu.Framework.Extensions.Color4Extensions;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.UserInterface;
namespace osu.Game.Graphics.UserInterface
{
public class OsuMenu : Menu
public class OsuMenu<TItem> : Menu<TItem>
where TItem : MenuItem
{
public OsuMenu()
{
CornerRadius = 4;
Background.Colour = Color4.Black.Opacity(0.5f);
ItemsContainer.Padding = new MarginPadding(5);
BackgroundColour = Color4.Black.Opacity(0.5f);
}
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
protected override void AnimateClose() => this.FadeOut(300, Easing.OutQuint);
protected override void UpdateContentHeight()
protected override void UpdateMenuHeight()
{
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, Easing.OutQuint);
}
protected override FlowContainer<MenuItemRepresentation> CreateItemsFlow()
{
var flow = base.CreateItemsFlow();
flow.Padding = new MarginPadding(5);
return flow;
}
}
public class OsuMenu : OsuMenu<MenuItem>
{
}
}