diff --git a/osu.Game/Graphics/Containers/OsuClickableContainer.cs b/osu.Game/Graphics/Containers/OsuClickableContainer.cs index 8df533ad6e..2cae413de8 100644 --- a/osu.Game/Graphics/Containers/OsuClickableContainer.cs +++ b/osu.Game/Graphics/Containers/OsuClickableContainer.cs @@ -8,7 +8,7 @@ using osu.Game.Graphics.UserInterface; namespace osu.Game.Graphics.Containers { - public class OsuClickableContainer : ClickableContainer + public class OsuClickableContainer : ClickableContainer, IHasHoverSounds { private readonly HoverSampleSet sampleSet; @@ -16,6 +16,8 @@ namespace osu.Game.Graphics.Containers protected override Container Content => content; + public bool ShouldPlayHoverSound => true; + public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal) { this.sampleSet = sampleSet; diff --git a/osu.Game/Graphics/UserInterface/HoverSounds.cs b/osu.Game/Graphics/UserInterface/HoverSounds.cs index 24dbe37567..ea452650b4 100644 --- a/osu.Game/Graphics/UserInterface/HoverSounds.cs +++ b/osu.Game/Graphics/UserInterface/HoverSounds.cs @@ -9,6 +9,7 @@ using osu.Framework.Extensions; using osu.Framework.Graphics; using osu.Framework.Graphics.Containers; using osu.Framework.Input; +using static osu.Game.Online.Chat.ChatLink; namespace osu.Game.Graphics.UserInterface { @@ -30,7 +31,7 @@ namespace osu.Game.Graphics.UserInterface protected override bool OnHover(InputState state) { - sampleHover?.Play(); + if ((Parent as IHasHoverSounds).ShouldPlayHoverSound) sampleHover?.Play(); return base.OnHover(state); } @@ -50,4 +51,9 @@ namespace osu.Game.Graphics.UserInterface [Description("-softer")] Soft } + + public interface IHasHoverSounds + { + bool ShouldPlayHoverSound { get; } + } }