mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 09:22:54 +08:00
AlwaysReceiveInput and InternalContains.
This commit is contained in:
parent
e17f728282
commit
ab8a5afdb9
@ -28,6 +28,10 @@ namespace osu.Game.Modes.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;
|
||||||
|
|
||||||
@ -91,10 +95,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Since the DrawableSlider itself is just a container without a size we need to
|
|
||||||
// pass all input through.
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
private int currentRepeat;
|
private int currentRepeat;
|
||||||
|
|
||||||
protected override void Update()
|
protected override void Update()
|
||||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Modes.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;
|
||||||
|
|
||||||
@ -69,8 +71,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables
|
|||||||
disc.Scale = scaleToCircle;
|
disc.Scale = scaleToCircle;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
protected override void CheckJudgement(bool userTriggered)
|
protected override void CheckJudgement(bool userTriggered)
|
||||||
{
|
{
|
||||||
if (Time.Current < HitObject.StartTime) return;
|
if (Time.Current < HitObject.StartTime) return;
|
||||||
|
@ -19,8 +19,6 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
|||||||
{
|
{
|
||||||
public class SpinnerDisc : CircularContainer
|
public class SpinnerDisc : CircularContainer
|
||||||
{
|
{
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
protected Sprite Disc;
|
protected Sprite Disc;
|
||||||
|
|
||||||
public SRGBColour DiscColour
|
public SRGBColour DiscColour
|
||||||
@ -101,6 +99,8 @@ namespace osu.Game.Modes.Osu.Objects.Drawables.Pieces
|
|||||||
|
|
||||||
public SpinnerDisc()
|
public SpinnerDisc()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
|
@ -18,10 +18,10 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private Bindable<bool> parallaxEnabled;
|
private Bindable<bool> parallaxEnabled;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
public ParallaxContainer()
|
public ParallaxContainer()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
AddInternal(content = new Container
|
AddInternal(content = new Container
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,6 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
{
|
{
|
||||||
internal class CursorTrail : Drawable
|
internal class CursorTrail : Drawable
|
||||||
{
|
{
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
public override bool HandleInput => true;
|
public override bool HandleInput => true;
|
||||||
|
|
||||||
private int currentIndex;
|
private int currentIndex;
|
||||||
@ -59,6 +58,7 @@ namespace osu.Game.Graphics.Cursor
|
|||||||
|
|
||||||
public CursorTrail()
|
public CursorTrail()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
|
|
||||||
for (int i = 0; i < max_sprites; i++)
|
for (int i = 0; i < max_sprites; i++)
|
||||||
|
@ -10,10 +10,9 @@ namespace osu.Game.Graphics.Processing
|
|||||||
{
|
{
|
||||||
internal class RatioAdjust : Container
|
internal class RatioAdjust : Container
|
||||||
{
|
{
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
public RatioAdjust()
|
public RatioAdjust()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -88,7 +88,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
|
private bool didClick; // Used for making sure that the OnMouseDown animation can call instead of OnHoverLost's when clicking
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos);
|
protected override bool InternalContains(Vector2 screenSpacePos) => backgroundContainer.Contains(screenSpacePos);
|
||||||
|
|
||||||
protected override bool OnClick(Framework.Input.InputState state)
|
protected override bool OnClick(Framework.Input.InputState state)
|
||||||
{
|
{
|
||||||
|
@ -158,7 +158,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
|
protected override bool InternalContains(Vector2 screenSpacePos) => IconLayer.Contains(screenSpacePos) || TextLayer.Contains(screenSpacePos);
|
||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
|
@ -18,7 +18,6 @@ namespace osu.Game.Modes.UI
|
|||||||
/// The HitObjects contained in this Playfield.
|
/// The HitObjects contained in this Playfield.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
public HitObjectContainer<DrawableHitObject<TObject, TJudgement>> HitObjects;
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
internal Container<Drawable> ScaledContent;
|
internal Container<Drawable> ScaledContent;
|
||||||
|
|
||||||
@ -31,6 +30,8 @@ namespace osu.Game.Modes.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;
|
||||||
|
|
||||||
AddInternal(ScaledContent = new ScaledContainer
|
AddInternal(ScaledContent = new ScaledContainer
|
||||||
{
|
{
|
||||||
CustomWidth = customWidth,
|
CustomWidth = customWidth,
|
||||||
@ -77,12 +78,18 @@ namespace osu.Game.Modes.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 override bool Contains(Vector2 screenSpacePos) => true;
|
public ScaledContainer()
|
||||||
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public class HitObjectContainer<U> : Container<U> where U : Drawable
|
public class HitObjectContainer<U> : Container<U> where U : Drawable
|
||||||
{
|
{
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
public HitObjectContainer()
|
||||||
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -35,10 +35,10 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
private const float alpha_hovering = 0.8f;
|
private const float alpha_hovering = 0.8f;
|
||||||
private const float alpha_normal = 0.6f;
|
private const float alpha_normal = 0.6f;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
public Toolbar()
|
public Toolbar()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
new ToolbarBackground(),
|
new ToolbarBackground(),
|
||||||
@ -63,8 +63,9 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
new PassThroughFlowContainer
|
new FillFlowContainer
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
Origin = Anchor.TopRight,
|
Origin = Anchor.TopRight,
|
||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
@ -144,11 +145,5 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint);
|
MoveToY(-DrawSize.Y, transition_time, EasingTypes.OutQuint);
|
||||||
FadeOut(transition_time);
|
FadeOut(transition_time);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class PassThroughFlowContainer : FillFlowContainer
|
|
||||||
{
|
|
||||||
//needed to get input to the login overlay.
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -15,10 +15,10 @@ namespace osu.Game.Overlays.Toolbar
|
|||||||
|
|
||||||
public override RectangleF BoundingBox => button.BoundingBox;
|
public override RectangleF BoundingBox => button.BoundingBox;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
public ToolbarUserArea()
|
public ToolbarUserArea()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Y;
|
RelativeSizeAxes = Axes.Y;
|
||||||
AutoSizeAxes = Axes.X;
|
AutoSizeAxes = Axes.X;
|
||||||
|
|
||||||
|
@ -35,10 +35,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
private Key triggerKey;
|
private Key triggerKey;
|
||||||
private SampleChannel sampleClick;
|
private SampleChannel sampleClick;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos)
|
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||||
{
|
|
||||||
return box.Contains(screenSpacePos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
|
public Button(string text, string internalName, FontAwesome symbol, Color4 colour, Action clickAction = null, float extraWidth = 0, Key triggerKey = Key.Unknown)
|
||||||
{
|
{
|
||||||
|
@ -50,10 +50,7 @@ namespace osu.Game.Screens.Menu
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos)
|
protected override bool InternalContains(Vector2 screenSpacePos) => logoContainer.Contains(screenSpacePos);
|
||||||
{
|
|
||||||
return logoContainer.Contains(screenSpacePos);
|
|
||||||
}
|
|
||||||
|
|
||||||
public bool Ripple
|
public bool Ripple
|
||||||
{
|
{
|
||||||
|
@ -14,6 +14,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public KeyCounterCollection()
|
public KeyCounterCollection()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
Direction = FillDirection.Horizontal;
|
Direction = FillDirection.Horizontal;
|
||||||
AutoSizeAxes = Axes.Both;
|
AutoSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
@ -33,8 +35,6 @@ namespace osu.Game.Screens.Play
|
|||||||
counter.ResetCount();
|
counter.ResetCount();
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
//further: change default values here and in KeyCounter if needed, instead of passing them in every constructor
|
||||||
private bool isCounting;
|
private bool isCounting;
|
||||||
public bool IsCounting
|
public bool IsCounting
|
||||||
@ -111,12 +111,11 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(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.TriggerKeyDown(state, args));
|
protected override bool OnKeyDown(InputState state, KeyDownEventArgs args) => target.Children.Any(c => c.TriggerKeyDown(state, args));
|
||||||
|
@ -13,6 +13,7 @@ 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;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -29,8 +30,6 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
protected override bool OnMouseDown(InputState state, MouseDownEventArgs args)
|
||||||
{
|
{
|
||||||
if (args.Button == Button) IsLit = true;
|
if (args.Button == Button) IsLit = true;
|
||||||
|
@ -70,7 +70,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private FillFlowContainer retryCounterContainer;
|
private FillFlowContainer retryCounterContainer;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
public override bool HandleInput => State == Visibility.Visible;
|
public override bool HandleInput => State == Visibility.Visible;
|
||||||
|
|
||||||
protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In);
|
protected override void PopIn() => FadeIn(transition_duration, EasingTypes.In);
|
||||||
@ -217,6 +216,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public PauseOverlay()
|
public PauseOverlay()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -60,7 +60,7 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private SearchTextBox searchTextBox;
|
private SearchTextBox searchTextBox;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => base.Contains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
|
protected override bool InternalContains(Vector2 screenSpacePos) => base.InternalContains(screenSpacePos) || groupTabs.Contains(screenSpacePos) || sortTabs.Contains(screenSpacePos);
|
||||||
|
|
||||||
public FilterControl()
|
public FilterControl()
|
||||||
{
|
{
|
||||||
@ -75,7 +75,7 @@ namespace osu.Game.Screens.Select
|
|||||||
new Container
|
new Container
|
||||||
{
|
{
|
||||||
Padding = new MarginPadding(20),
|
Padding = new MarginPadding(20),
|
||||||
BypassContainsCheck = true,
|
AlwaysReceiveInput = true,
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
Width = 0.5f,
|
Width = 0.5f,
|
||||||
Anchor = Anchor.TopRight,
|
Anchor = Anchor.TopRight,
|
||||||
@ -107,7 +107,7 @@ namespace osu.Game.Screens.Select
|
|||||||
Direction = FillDirection.Horizontal,
|
Direction = FillDirection.Horizontal,
|
||||||
RelativeSizeAxes = Axes.X,
|
RelativeSizeAxes = Axes.X,
|
||||||
AutoSizeAxes = Axes.Y,
|
AutoSizeAxes = Axes.Y,
|
||||||
BypassContainsCheck = true,
|
AlwaysReceiveInput = true,
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
groupTabs = new OsuTabControl<GroupMode>
|
groupTabs = new OsuTabControl<GroupMode>
|
||||||
|
@ -26,8 +26,6 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
private const float padding = 80;
|
private const float padding = 80;
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
|
||||||
|
|
||||||
public Action OnBack;
|
public Action OnBack;
|
||||||
public Action OnStart;
|
public Action OnStart;
|
||||||
|
|
||||||
@ -69,6 +67,8 @@ namespace osu.Game.Screens.Select
|
|||||||
|
|
||||||
public Footer()
|
public Footer()
|
||||||
{
|
{
|
||||||
|
AlwaysReceiveInput = true;
|
||||||
|
|
||||||
const float bottom_tool_height = 50;
|
const float bottom_tool_height = 50;
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.X;
|
RelativeSizeAxes = Axes.X;
|
||||||
|
@ -83,7 +83,7 @@ namespace osu.Game.Screens.Select.Options
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool Contains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
protected override bool InternalContains(Vector2 screenSpacePos) => box.Contains(screenSpacePos);
|
||||||
|
|
||||||
public BeatmapOptionsButton()
|
public BeatmapOptionsButton()
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user