diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs
index ce50dbdc39..6fe1de2216 100644
--- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs
+++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs
@@ -44,8 +44,11 @@ namespace osu.Game.Graphics.Containers
content.AutoSizeAxes = AutoSizeAxes;
}
- AddInternal(content);
- Add(CreateHoverSounds(sampleSet));
+ AddRangeInternal(new Drawable[]
+ {
+ content,
+ CreateHoverSounds(sampleSet)
+ });
}
protected override void ClearInternal(bool disposeChildren = true) =>
diff --git a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs
index ed1838abd0..884834ebe8 100644
--- a/osu.Game/Graphics/UserInterface/HoverClickSounds.cs
+++ b/osu.Game/Graphics/UserInterface/HoverClickSounds.cs
@@ -44,7 +44,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnClick(ClickEvent e)
{
- if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition))
+ if (buttons.Contains(e.Button))
{
var channel = Enabled.Value ? sampleClick?.GetChannel() : sampleClickDisabled?.GetChannel();
diff --git a/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs b/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs
index 53f1c06a67..fee81e0e22 100644
--- a/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs
+++ b/osu.Game/Graphics/UserInterface/HoverSampleDebounceComponent.cs
@@ -5,19 +5,22 @@
using osu.Framework.Allocation;
using osu.Framework.Bindables;
-using osu.Framework.Graphics.Containers;
+using osu.Framework.Graphics;
using osu.Framework.Input.Events;
using osu.Game.Configuration;
+using osuTK;
namespace osu.Game.Graphics.UserInterface
{
///
/// Handles debouncing hover sounds at a global level to ensure the effects are not overwhelming.
///
- public abstract partial class HoverSampleDebounceComponent : CompositeDrawable
+ public abstract partial class HoverSampleDebounceComponent : Component
{
private Bindable lastPlaybackTime;
+ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) == true;
+
[BackgroundDependencyLoader]
private void load(SessionStatics statics)
{
diff --git a/osu.Game/Graphics/UserInterface/OsuButton.cs b/osu.Game/Graphics/UserInterface/OsuButton.cs
index 805dfcaa95..6467ae5783 100644
--- a/osu.Game/Graphics/UserInterface/OsuButton.cs
+++ b/osu.Game/Graphics/UserInterface/OsuButton.cs
@@ -116,7 +116,7 @@ namespace osu.Game.Graphics.UserInterface
});
if (hoverSounds.HasValue)
- Add(new HoverClickSounds(hoverSounds.Value) { Enabled = { BindTarget = Enabled } });
+ AddInternal(new HoverClickSounds(hoverSounds.Value) { Enabled = { BindTarget = Enabled } });
}
[BackgroundDependencyLoader]
diff --git a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
index dd8dd93d66..f810f51027 100644
--- a/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
+++ b/osu.Game/Rulesets/Edit/PlacementBlueprint.cs
@@ -121,7 +121,7 @@ namespace osu.Game.Rulesets.Edit
///
protected void ApplyDefaultsToHitObject() => HitObject.ApplyDefaults(beatmap.ControlPointInfo, beatmap.Difficulty);
- public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) ?? false;
+ public override bool ReceivePositionalInputAt(Vector2 screenSpacePos) => Parent?.ReceivePositionalInputAt(screenSpacePos) == true;
protected override bool Handle(UIEvent e)
{
diff --git a/osu.Game/Screens/Select/Carousel/CarouselHeader.cs b/osu.Game/Screens/Select/Carousel/CarouselHeader.cs
index e46f0da45d..7e668fcd87 100644
--- a/osu.Game/Screens/Select/Carousel/CarouselHeader.cs
+++ b/osu.Game/Screens/Select/Carousel/CarouselHeader.cs
@@ -46,7 +46,8 @@ namespace osu.Game.Screens.Select.Carousel
Children = new Drawable[]
{
Content,
- hoverLayer = new HoverLayer()
+ hoverLayer = new HoverLayer(),
+ new HeaderSounds(),
}
};
}
@@ -91,10 +92,8 @@ namespace osu.Game.Screens.Select.Carousel
}
}
- public partial class HoverLayer : HoverSampleDebounceComponent
+ public partial class HoverLayer : CompositeDrawable
{
- private Sample? sampleHover;
-
private Box box = null!;
public HoverLayer()
@@ -103,7 +102,7 @@ namespace osu.Game.Screens.Select.Carousel
}
[BackgroundDependencyLoader]
- private void load(AudioManager audio, OsuColour colours)
+ private void load(OsuColour colours)
{
InternalChild = box = new Box
{
@@ -112,8 +111,6 @@ namespace osu.Game.Screens.Select.Carousel
Blending = BlendingParameters.Additive,
RelativeSizeAxes = Axes.Both,
};
-
- sampleHover = audio.Samples.Get("UI/default-hover");
}
public bool InsetForBorder
@@ -147,6 +144,17 @@ namespace osu.Game.Screens.Select.Carousel
box.FadeOut(1000, Easing.OutQuint);
base.OnHoverLost(e);
}
+ }
+
+ private partial class HeaderSounds : HoverSampleDebounceComponent
+ {
+ private Sample? sampleHover;
+
+ [BackgroundDependencyLoader]
+ private void load(AudioManager audio)
+ {
+ sampleHover = audio.Samples.Get("UI/default-hover");
+ }
public override void PlayHoverSample()
{