mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:43:21 +08:00
Make addition of nested GlobalActionContainer in OsuGameTestScene optional
This commit is contained in:
parent
e486e521ff
commit
53c1bc666c
@ -36,6 +36,8 @@ namespace osu.Game.Tests.Visual.Navigation
|
|||||||
|
|
||||||
protected override bool UseFreshStoragePerRun => true;
|
protected override bool UseFreshStoragePerRun => true;
|
||||||
|
|
||||||
|
protected override bool CreateNestedActionContainer => false;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(GameHost host)
|
private void load(GameHost host)
|
||||||
{
|
{
|
||||||
|
@ -24,18 +24,31 @@ namespace osu.Game.Tests.Visual
|
|||||||
private readonly TriangleButton buttonTest;
|
private readonly TriangleButton buttonTest;
|
||||||
private readonly TriangleButton buttonLocal;
|
private readonly TriangleButton buttonLocal;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Whether to create a nested container to handle <see cref="GlobalAction"/>s that result from local (manual) test input.
|
||||||
|
/// This should be disabled when instantiating an <see cref="OsuGame"/> instance else actions will be lost.
|
||||||
|
/// </summary>
|
||||||
|
protected virtual bool CreateNestedActionContainer => true;
|
||||||
|
|
||||||
protected OsuManualInputManagerTestScene()
|
protected OsuManualInputManagerTestScene()
|
||||||
{
|
{
|
||||||
MenuCursorContainer cursorContainer;
|
MenuCursorContainer cursorContainer;
|
||||||
|
|
||||||
|
CompositeDrawable mainContent =
|
||||||
|
(cursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both })
|
||||||
|
.WithChild(content = new OsuTooltipContainer(cursorContainer.Cursor) { RelativeSizeAxes = Axes.Both });
|
||||||
|
|
||||||
|
if (CreateNestedActionContainer)
|
||||||
|
{
|
||||||
|
mainContent = new GlobalActionContainer(null, null).WithChild(mainContent);
|
||||||
|
}
|
||||||
|
|
||||||
base.Content.AddRange(new Drawable[]
|
base.Content.AddRange(new Drawable[]
|
||||||
{
|
{
|
||||||
InputManager = new ManualInputManager
|
InputManager = new ManualInputManager
|
||||||
{
|
{
|
||||||
UseParentInput = true,
|
UseParentInput = true,
|
||||||
Child = new GlobalActionContainer(null, null)
|
Child = mainContent
|
||||||
.WithChild((cursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both })
|
|
||||||
.WithChild(content = new OsuTooltipContainer(cursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }))
|
|
||||||
},
|
},
|
||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user