Move InputManager to a higher and more implicit level.

Also makes KeyCounterCollection work with replays.
This commit is contained in:
Dean Herbert
2017-03-07 19:30:39 +09:00
parent 1fb846e61d
commit 02cab41d34
12 changed files with 84 additions and 53 deletions

View File

@ -1,12 +1,10 @@
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Game.Modes.Objects;
using osu.Game.Modes.Objects.Drawables;
using osu.Game.Screens.Play;
using OpenTK;
namespace osu.Game.Modes.UI
@ -18,7 +16,7 @@ namespace osu.Game.Modes.UI
public virtual void Add(DrawableHitObject<T> h) => HitObjects.Add(h);
private Container<Drawable> scaledContent;
internal Container<Drawable> ScaledContent;
public override bool Contains(Vector2 screenSpacePos) => true;
@ -30,7 +28,7 @@ namespace osu.Game.Modes.UI
/// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width.</param>
protected Playfield(float? customWidth = null)
{
AddInternal(scaledContent = new ScaledContainer
AddInternal(ScaledContent = new ScaledContainer
{
CustomWidth = customWidth,
RelativeSizeAxes = Axes.Both,
@ -49,23 +47,6 @@ namespace osu.Game.Modes.UI
});
}
/// <summary>
/// An optional inputManager to provide interactivity etc.
/// </summary>
public PlayerInputManager InputManager;
[BackgroundDependencyLoader]
private void load()
{
if (InputManager != null)
{
//if we've been provided an InputManager, we want it to sit inside the scaledcontainer
scaledContent.Remove(Content);
scaledContent.Add(InputManager);
InputManager.Add(Content);
}
}
public virtual void PostProcess()
{
}