mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 13:37:25 +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 CreateNestedActionContainer => false;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(GameHost host)
|
||||
{
|
||||
|
@ -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
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user