mirror of
https://github.com/ppy/osu.git
synced 2025-02-16 06:33:21 +08:00
Update in-line with framework changes.
This commit is contained in:
parent
66db3389f6
commit
fc6c682d88
@ -1 +1 @@
|
|||||||
Subproject commit 2958d6fda1be252a0f479609090e72814b177c91
|
Subproject commit 2cb3e59c8bc7e67edef4dfe7f9c7dfc01db386a7
|
@ -3,8 +3,9 @@
|
|||||||
|
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Game.Graphics.Cursor;
|
using osu.Framework.Graphics.UserInterface;
|
||||||
using osu.Game.Graphics.UserInterface;
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
@ -66,30 +67,30 @@ namespace osu.Desktop.Tests.Visual
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class MyContextMenuContainer : Container, IHasOsuContextMenu
|
private class MyContextMenuContainer : Container, IHasContextMenu
|
||||||
{
|
{
|
||||||
public OsuContextMenuItem[] ContextMenuItems => new[]
|
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
{
|
{
|
||||||
new OsuContextMenuItem(@"Some option"),
|
new OsuMenuItem(@"Some option"),
|
||||||
new OsuContextMenuItem(@"Highlighted option", MenuItemType.Highlighted),
|
new OsuMenuItem(@"Highlighted option", MenuItemType.Highlighted),
|
||||||
new OsuContextMenuItem(@"Another option"),
|
new OsuMenuItem(@"Another option"),
|
||||||
new OsuContextMenuItem(@"Choose me please"),
|
new OsuMenuItem(@"Choose me please"),
|
||||||
new OsuContextMenuItem(@"And me too"),
|
new OsuMenuItem(@"And me too"),
|
||||||
new OsuContextMenuItem(@"Trying to fill"),
|
new OsuMenuItem(@"Trying to fill"),
|
||||||
new OsuContextMenuItem(@"Destructive option", MenuItemType.Destructive),
|
new OsuMenuItem(@"Destructive option", MenuItemType.Destructive),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private class AnotherContextMenuContainer : Container, IHasOsuContextMenu
|
private class AnotherContextMenuContainer : Container, IHasContextMenu
|
||||||
{
|
{
|
||||||
public OsuContextMenuItem[] ContextMenuItems => new[]
|
public MenuItem[] ContextMenuItems => new MenuItem[]
|
||||||
{
|
{
|
||||||
new OsuContextMenuItem(@"Simple option"),
|
new OsuMenuItem(@"Simple option"),
|
||||||
new OsuContextMenuItem(@"Simple very very long option"),
|
new OsuMenuItem(@"Simple very very long option"),
|
||||||
new OsuContextMenuItem(@"Change width", MenuItemType.Highlighted, () => this.ResizeWidthTo(Width * 2, 100, Easing.OutQuint)),
|
new OsuMenuItem(@"Change width", MenuItemType.Highlighted, () => this.ResizeWidthTo(Width * 2, 100, Easing.OutQuint)),
|
||||||
new OsuContextMenuItem(@"Change height", MenuItemType.Highlighted, () => this.ResizeHeightTo(Height * 2, 100, Easing.OutQuint)),
|
new OsuMenuItem(@"Change height", MenuItemType.Highlighted, () => this.ResizeHeightTo(Height * 2, 100, Easing.OutQuint)),
|
||||||
new OsuContextMenuItem(@"Change width back", MenuItemType.Destructive, () => this.ResizeWidthTo(Width / 2, 100, Easing.OutQuint)),
|
new OsuMenuItem(@"Change width back", MenuItemType.Destructive, () => this.ResizeWidthTo(Width / 2, 100, Easing.OutQuint)),
|
||||||
new OsuContextMenuItem(@"Change height back", MenuItemType.Destructive, () => this.ResizeHeightTo(Height / 2, 100, Easing.OutQuint)),
|
new OsuMenuItem(@"Change height back", MenuItemType.Destructive, () => this.ResizeHeightTo(Height / 2, 100, Easing.OutQuint)),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
using osu.Framework.Graphics.Cursor;
|
|
||||||
using osu.Game.Graphics.UserInterface;
|
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Cursor
|
|
||||||
{
|
|
||||||
public interface IHasOsuContextMenu : IHasContextMenu<OsuContextMenuItem>
|
|
||||||
{
|
|
||||||
}
|
|
||||||
}
|
|
@ -7,8 +7,8 @@ using osu.Game.Graphics.UserInterface;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.Cursor
|
namespace osu.Game.Graphics.Cursor
|
||||||
{
|
{
|
||||||
public class OsuContextMenuContainer : ContextMenuContainer<OsuContextMenuItem>
|
public class OsuContextMenuContainer : ContextMenuContainer
|
||||||
{
|
{
|
||||||
protected override Menu<OsuContextMenuItem> CreateMenu() => new OsuContextMenu<OsuContextMenuItem>();
|
protected override Menu CreateMenu() => new OsuContextMenu();
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -1,6 +1,7 @@
|
|||||||
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
|
||||||
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
||||||
|
|
||||||
|
using System;
|
||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio;
|
using osu.Framework.Audio;
|
||||||
@ -15,8 +16,7 @@ using osu.Game.Graphics.Sprites;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuContextMenu<TItem> : OsuMenu<TItem>
|
public class OsuContextMenu : OsuMenu
|
||||||
where TItem : OsuContextMenuItem
|
|
||||||
{
|
{
|
||||||
private const int fade_duration = 250;
|
private const int fade_duration = 250;
|
||||||
|
|
||||||
@ -42,7 +42,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding { Vertical = DrawableOsuContextMenuItem.MARGIN_VERTICAL };
|
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding { Vertical = DrawableOsuContextMenuItem.MARGIN_VERTICAL };
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(TItem item) => new DrawableOsuContextMenuItem(this, item);
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableOsuContextMenuItem(item);
|
||||||
|
|
||||||
#region DrawableOsuContextMenuItem
|
#region DrawableOsuContextMenuItem
|
||||||
private class DrawableOsuContextMenuItem : DrawableMenuItem
|
private class DrawableOsuContextMenuItem : DrawableMenuItem
|
||||||
@ -57,9 +57,11 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private TextContainer text;
|
private TextContainer text;
|
||||||
|
|
||||||
public DrawableOsuContextMenuItem(Menu<TItem> menu, TItem item)
|
public DrawableOsuContextMenuItem(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
|
if (!(Item is OsuMenuItem))
|
||||||
|
throw new ArgumentException($"{nameof(item)} must be a {nameof(OsuMenuItem)}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -76,7 +78,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private void updateTextColour()
|
private void updateTextColour()
|
||||||
{
|
{
|
||||||
switch (Item.Type)
|
switch (((OsuMenuItem)Item).Type)
|
||||||
{
|
{
|
||||||
case MenuItemType.Standard:
|
case MenuItemType.Standard:
|
||||||
text.Colour = Color4.White;
|
text.Colour = Color4.White;
|
||||||
|
@ -68,7 +68,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
public readonly Bindable<Color4?> AccentColour = new Bindable<Color4?>();
|
||||||
|
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(DropdownMenuItem<T> item)
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item)
|
||||||
{
|
{
|
||||||
var newItem = new DrawableOsuDropdownMenuItem(item);
|
var newItem = new DrawableOsuDropdownMenuItem(item);
|
||||||
newItem.AccentColour.BindTo(AccentColour);
|
newItem.AccentColour.BindTo(AccentColour);
|
||||||
@ -86,7 +86,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
private Color4 nonAccentHoverColour;
|
private Color4 nonAccentHoverColour;
|
||||||
private Color4 nonAccentSelectedColour;
|
private Color4 nonAccentSelectedColour;
|
||||||
|
|
||||||
public DrawableOsuDropdownMenuItem(DropdownMenuItem<T> item)
|
public DrawableOsuDropdownMenuItem(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
Foreground.Padding = new MarginPadding(2);
|
Foreground.Padding = new MarginPadding(2);
|
||||||
|
@ -8,8 +8,7 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuMenu<TItem> : Menu<TItem>
|
public class OsuMenu : Menu
|
||||||
where TItem : MenuItem
|
|
||||||
{
|
{
|
||||||
public OsuMenu()
|
public OsuMenu()
|
||||||
{
|
{
|
||||||
|
@ -6,17 +6,17 @@ using osu.Framework.Graphics.UserInterface;
|
|||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
public class OsuContextMenuItem : MenuItem
|
public class OsuMenuItem : MenuItem
|
||||||
{
|
{
|
||||||
public readonly MenuItemType Type;
|
public readonly MenuItemType Type;
|
||||||
|
|
||||||
public OsuContextMenuItem(string text, MenuItemType type = MenuItemType.Standard)
|
public OsuMenuItem(string text, MenuItemType type = MenuItemType.Standard)
|
||||||
: base(text)
|
: base(text)
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
||||||
}
|
}
|
||||||
|
|
||||||
public OsuContextMenuItem(string text, MenuItemType type, Action action)
|
public OsuMenuItem(string text, MenuItemType type, Action action)
|
||||||
: base(text, action)
|
: base(text, action)
|
||||||
{
|
{
|
||||||
Type = type;
|
Type = type;
|
@ -179,16 +179,16 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
MaxHeight = 400;
|
MaxHeight = 400;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(DropdownMenuItem<T> item)
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item)
|
||||||
{
|
{
|
||||||
var result = new DrawableOsuTabDropdownMenuItem(this, item);
|
var result = new DrawableOsuTabDropdownMenuItem(item);
|
||||||
result.AccentColour.BindTo(AccentColour);
|
result.AccentColour.BindTo(AccentColour);
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DrawableOsuTabDropdownMenuItem : DrawableOsuDropdownMenuItem
|
private class DrawableOsuTabDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||||
{
|
{
|
||||||
public DrawableOsuTabDropdownMenuItem(Menu<DropdownMenuItem<T>> menu, DropdownMenuItem<T> item)
|
public DrawableOsuTabDropdownMenuItem(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
ForegroundColourHover = Color4.Black;
|
ForegroundColourHover = Color4.Black;
|
||||||
|
@ -308,11 +308,11 @@ namespace osu.Game.Overlays.Settings.Sections.General
|
|||||||
|
|
||||||
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding();
|
protected override MarginPadding ItemFlowContainerPadding => new MarginPadding();
|
||||||
|
|
||||||
protected override DrawableMenuItem CreateDrawableMenuItem(DropdownMenuItem<UserAction> item) => new DrawableUserDropdownMenuItem(this, item);
|
protected override DrawableMenuItem CreateDrawableMenuItem(MenuItem item) => new DrawableUserDropdownMenuItem(item);
|
||||||
|
|
||||||
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
|
private class DrawableUserDropdownMenuItem : DrawableOsuDropdownMenuItem
|
||||||
{
|
{
|
||||||
public DrawableUserDropdownMenuItem(Menu<DropdownMenuItem<UserAction>> menu, DropdownMenuItem<UserAction> item)
|
public DrawableUserDropdownMenuItem(MenuItem item)
|
||||||
: base(item)
|
: base(item)
|
||||||
{
|
{
|
||||||
Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 5 };
|
Foreground.Padding = new MarginPadding { Top = 5, Bottom = 5, Left = 10, Right = 5 };
|
||||||
|
@ -84,7 +84,6 @@
|
|||||||
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuClickableContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuFocusedOverlayContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuScrollContainer.cs" />
|
||||||
<Compile Include="Graphics\Cursor\IHasOsuContextMenu.cs" />
|
|
||||||
<Compile Include="Graphics\Cursor\OsuContextMenuContainer.cs" />
|
<Compile Include="Graphics\Cursor\OsuContextMenuContainer.cs" />
|
||||||
<Compile Include="Graphics\Containers\OsuTextFlowContainer.cs" />
|
<Compile Include="Graphics\Containers\OsuTextFlowContainer.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\IconButton.cs" />
|
<Compile Include="Graphics\UserInterface\IconButton.cs" />
|
||||||
@ -92,7 +91,7 @@
|
|||||||
<Compile Include="Graphics\UserInterface\LineGraph.cs" />
|
<Compile Include="Graphics\UserInterface\LineGraph.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\MenuItemType.cs" />
|
<Compile Include="Graphics\UserInterface\MenuItemType.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuContextMenu.cs" />
|
<Compile Include="Graphics\UserInterface\OsuContextMenu.cs" />
|
||||||
<Compile Include="Graphics\UserInterface\OsuContextMenuItem.cs" />
|
<Compile Include="Graphics\UserInterface\OsuMenuItem.cs" />
|
||||||
<Compile Include="Input\Bindings\DatabasedKeyBinding.cs" />
|
<Compile Include="Input\Bindings\DatabasedKeyBinding.cs" />
|
||||||
<Compile Include="Input\Bindings\DatabasedKeyBindingInputManager.cs" />
|
<Compile Include="Input\Bindings\DatabasedKeyBindingInputManager.cs" />
|
||||||
<Compile Include="Input\KeyBindingStore.cs" />
|
<Compile Include="Input\KeyBindingStore.cs" />
|
||||||
|
Loading…
Reference in New Issue
Block a user