mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Update OsuMenu in line with framework.
This commit is contained in:
Submodule osu-framework updated: da5fbf8c58...5a189d1050
@ -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>
|
||||||
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user