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

Make addition of nested GlobalActionContainer in OsuGameTestScene optional

This commit is contained in:
Dean Herbert 2021-04-06 15:05:34 +09:00
parent e486e521ff
commit 53c1bc666c
2 changed files with 18 additions and 3 deletions

View File

@ -36,6 +36,8 @@ namespace osu.Game.Tests.Visual.Navigation
protected override bool UseFreshStoragePerRun => true;
protected override bool CreateNestedActionContainer => false;
[BackgroundDependencyLoader]
private void load(GameHost host)
{

View File

@ -24,18 +24,31 @@ namespace osu.Game.Tests.Visual
private readonly TriangleButton buttonTest;
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()
{
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[]
{
InputManager = new ManualInputManager
{
UseParentInput = true,
Child = new GlobalActionContainer(null, null)
.WithChild((cursorContainer = new MenuCursorContainer { RelativeSizeAxes = Axes.Both })
.WithChild(content = new OsuTooltipContainer(cursorContainer.Cursor) { RelativeSizeAxes = Axes.Both }))
Child = mainContent
},
new Container
{