1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 09:22:54 +08:00

Get rid of AlwaysReceiveInput

This commit is contained in:
Thomas Müller 2017-06-23 18:02:24 +02:00
parent 7e5b920c92
commit f5829860a2
17 changed files with 11 additions and 40 deletions

@ -1 +1 @@
Subproject commit 97ff3376d1bdac3703d442e62f5ee6a36eb3b73f Subproject commit 6a81d52ba24c4c4bcd83bf1062143ad93d8f4545

View File

@ -28,10 +28,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public DrawableSlider(Slider s) : base(s) public DrawableSlider(Slider s) : base(s)
{ {
// Since the DrawableSlider itself is just a container without a size we need to
// pass all input through.
AlwaysReceiveInput = true;
SliderBouncer bouncer1; SliderBouncer bouncer1;
slider = s; slider = s;

View File

@ -38,8 +38,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables
public DrawableSpinner(Spinner s) : base(s) public DrawableSpinner(Spinner s) : base(s)
{ {
AlwaysReceiveInput = true;
Origin = Anchor.Centre; Origin = Anchor.Centre;
Position = s.Position; Position = s.Position;

View File

@ -31,7 +31,6 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
{ {
spinner = s; spinner = s;
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
Children = new Drawable[] Children = new Drawable[]
@ -40,6 +39,8 @@ namespace osu.Game.Rulesets.Osu.Objects.Drawables.Pieces
}; };
} }
protected override bool InternalContains(Vector2 screenSpacePos) => true;
private bool tracking; private bool tracking;
public bool Tracking public bool Tracking
{ {

View File

@ -19,8 +19,6 @@ namespace osu.Game.Graphics.Containers
public ParallaxContainer() public ParallaxContainer()
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
AddInternal(content = new Container AddInternal(content = new Container
{ {

View File

@ -65,7 +65,6 @@ namespace osu.Game.Graphics.Cursor
// as we are currently very dependent on having a running clock, let's make our own clock for the time being. // as we are currently very dependent on having a running clock, let's make our own clock for the time being.
Clock = new FramedClock(); Clock = new FramedClock();
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
for (int i = 0; i < max_sprites; i++) for (int i = 0; i < max_sprites; i++)
@ -75,6 +74,8 @@ namespace osu.Game.Graphics.Cursor
} }
} }
protected override bool InternalContains(Vector2 screenSpacePos) => true;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(ShaderManager shaders, TextureStore textures) private void load(ShaderManager shaders, TextureStore textures)
{ {

View File

@ -12,7 +12,6 @@ namespace osu.Game.Graphics.Processing
{ {
public RatioAdjust() public RatioAdjust()
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }

View File

@ -152,7 +152,6 @@ namespace osu.Game
{ {
new Container new Container
{ {
AlwaysReceiveInput = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Depth = float.MinValue, Depth = float.MinValue,
Children = new Drawable[] Children = new Drawable[]

View File

@ -82,7 +82,6 @@ namespace osu.Game.Overlays.SearchableList
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
Direction = FillDirection.Vertical, Direction = FillDirection.Vertical,
AlwaysReceiveInput = true,
Children = new Drawable[] Children = new Drawable[]
{ {
Header = CreateHeader(), Header = CreateHeader(),

View File

@ -33,8 +33,6 @@ namespace osu.Game.Overlays.Toolbar
public Toolbar() public Toolbar()
{ {
AlwaysReceiveInput = true;
Children = new Drawable[] Children = new Drawable[]
{ {
new ToolbarBackground(), new ToolbarBackground(),
@ -55,7 +53,6 @@ namespace osu.Game.Overlays.Toolbar
}, },
new FillFlowContainer new FillFlowContainer
{ {
AlwaysReceiveInput = true,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
Origin = Anchor.TopRight, Origin = Anchor.TopRight,
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,

View File

@ -17,8 +17,6 @@ namespace osu.Game.Overlays.Toolbar
public ToolbarUserArea() public ToolbarUserArea()
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Y; RelativeSizeAxes = Axes.Y;
AutoSizeAxes = Axes.X; AutoSizeAxes = Axes.X;

View File

@ -37,8 +37,6 @@ namespace osu.Game.Rulesets.UI
/// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width.</param> /// <param name="customWidth">Whether we want our internal coordinate system to be scaled to a specified width.</param>
protected Playfield(float? customWidth = null) protected Playfield(float? customWidth = null)
{ {
AlwaysReceiveInput = true;
// Default height since we force relative size axes // Default height since we force relative size axes
Size = Vector2.One; Size = Vector2.One;
@ -50,7 +48,6 @@ namespace osu.Game.Rulesets.UI
{ {
content = new Container content = new Container
{ {
AlwaysReceiveInput = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
} }
} }
@ -100,19 +97,10 @@ namespace osu.Game.Rulesets.UI
//dividing by the customwidth will effectively scale our content to the required container size. //dividing by the customwidth will effectively scale our content to the required container size.
protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale; protected override Vector2 DrawScale => CustomWidth.HasValue ? new Vector2(DrawSize.X / CustomWidth.Value) : base.DrawScale;
public ScaledContainer()
{
AlwaysReceiveInput = true;
}
} }
public class HitObjectContainer<U> : Container<U> where U : Drawable public class HitObjectContainer<U> : Container<U> where U : Drawable
{ {
public HitObjectContainer()
{
AlwaysReceiveInput = true;
}
} }
} }
} }

View File

@ -9,6 +9,7 @@ using osu.Framework.Input;
using osu.Framework.Configuration; using osu.Framework.Configuration;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Game.Configuration; using osu.Game.Configuration;
using OpenTK;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
@ -20,8 +21,6 @@ namespace osu.Game.Screens.Play
public KeyCounterCollection() public KeyCounterCollection()
{ {
AlwaysReceiveInput = true;
Direction = FillDirection.Horizontal; Direction = FillDirection.Horizontal;
AutoSizeAxes = Axes.Both; AutoSizeAxes = Axes.Both;
} }
@ -124,11 +123,12 @@ namespace osu.Game.Screens.Play
public Receptor(KeyCounterCollection target) public Receptor(KeyCounterCollection target)
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
this.target = target; this.target = target;
} }
protected override bool InternalContains(Vector2 screenSpacePos) => true;
public override bool HandleInput => true; public override bool HandleInput => true;
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args)); protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerOnKeyDown(state, args));

View File

@ -3,6 +3,7 @@
using osu.Framework.Input; using osu.Framework.Input;
using OpenTK.Input; using OpenTK.Input;
using OpenTK;
namespace osu.Game.Screens.Play namespace osu.Game.Screens.Play
{ {
@ -12,10 +13,11 @@ namespace osu.Game.Screens.Play
public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button)) public KeyCounterMouse(MouseButton button) : base(getStringRepresentation(button))
{ {
AlwaysReceiveInput = true;
Button = button; Button = button;
} }
protected override bool InternalContains(Vector2 screenSpacePos) => true;
private static string getStringRepresentation(MouseButton button) private static string getStringRepresentation(MouseButton button)
{ {
switch (button) switch (button)

View File

@ -186,7 +186,6 @@ namespace osu.Game.Screens.Play
protected MenuOverlay() protected MenuOverlay()
{ {
AlwaysReceiveInput = true;
RelativeSizeAxes = Axes.Both; RelativeSizeAxes = Axes.Both;
} }

View File

@ -34,8 +34,6 @@ namespace osu.Game.Screens.Play
public SkipButton(double startTime) public SkipButton(double startTime)
{ {
AlwaysReceiveInput = true;
this.startTime = startTime; this.startTime = startTime;
RelativePositionAxes = Axes.Both; RelativePositionAxes = Axes.Both;

View File

@ -82,7 +82,6 @@ namespace osu.Game.Screens.Select
new Container new Container
{ {
Padding = new MarginPadding(20), Padding = new MarginPadding(20),
AlwaysReceiveInput = true,
RelativeSizeAxes = Axes.Both, RelativeSizeAxes = Axes.Both,
Width = 0.5f, Width = 0.5f,
Anchor = Anchor.TopRight, Anchor = Anchor.TopRight,
@ -109,7 +108,6 @@ namespace osu.Game.Screens.Select
Direction = FillDirection.Horizontal, Direction = FillDirection.Horizontal,
RelativeSizeAxes = Axes.X, RelativeSizeAxes = Axes.X,
AutoSizeAxes = Axes.Y, AutoSizeAxes = Axes.Y,
AlwaysReceiveInput = true,
Children = new Drawable[] Children = new Drawable[]
{ {
groupTabs = new OsuTabControl<GroupMode> groupTabs = new OsuTabControl<GroupMode>