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:
parent
67513177e6
commit
06c392d6f2
@ -1 +1 @@
|
|||||||
Subproject commit da5fbf8c580b079671298f6da54be10a00bf434c
|
Subproject commit 5a189d1050579b217bfe6b6c17c3ee6d6ef9c839
|
@ -5,28 +5,39 @@ using OpenTK;
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.UserInterface;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuMenu : Menu
|
public class OsuMenu<TItem> : Menu<TItem>
|
||||||
|
where TItem : MenuItem
|
||||||
{
|
{
|
||||||
public OsuMenu()
|
public OsuMenu()
|
||||||
{
|
{
|
||||||
CornerRadius = 4;
|
CornerRadius = 4;
|
||||||
Background.Colour = Color4.Black.Opacity(0.5f);
|
BackgroundColour = Color4.Black.Opacity(0.5f);
|
||||||
|
|
||||||
ItemsContainer.Padding = new MarginPadding(5);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
|
protected override void AnimateOpen() => this.FadeIn(300, Easing.OutQuint);
|
||||||
|
|
||||||
protected override void AnimateClose() => this.FadeOut(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;
|
var actualHeight = (RelativeSizeAxes & Axes.Y) > 0 ? 1 : ContentHeight;
|
||||||
this.ResizeTo(new Vector2(1, State == MenuState.Opened ? actualHeight : 0), 300, Easing.OutQuint);
|
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>
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user