1
0
mirror of https://github.com/ppy/osu.git synced 2025-02-13 15:53:51 +08:00

Removed ICanDisableHoverSounds interface

This commit is contained in:
FreezyLemon 2017-12-11 10:42:36 +01:00
parent 2568ac1bf7
commit 13bc50ad56
2 changed files with 5 additions and 16 deletions

View File

@ -30,8 +30,7 @@ namespace osu.Game.Graphics.UserInterface
protected override bool OnHover(InputState state)
{
// If Parent does not implement the interface, still play the sample
if ((Parent as ICanDisableHoverSounds)?.ShouldPlayHoverSound != false) sampleHover?.Play();
sampleHover?.Play();
return base.OnHover(state);
}
@ -51,13 +50,4 @@ namespace osu.Game.Graphics.UserInterface
[Description("-softer")]
Soft
}
/// <summary>
/// Classes implementing this interface can choose whether or not the HoverSounds should be played.
/// <para>If this is not implemented, the sounds will always be played when OnHover is triggered.</para>
/// </summary>
public interface ICanDisableHoverSounds
{
bool ShouldPlayHoverSound { get; }
}
}

View File

@ -4,6 +4,7 @@
using OpenTK.Graphics;
using osu.Framework.Allocation;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Colour;
using osu.Framework.Graphics.Containers;
using osu.Framework.Graphics.Cursor;
using osu.Framework.Input;
@ -180,15 +181,13 @@ namespace osu.Game.Online.Chat
protected override bool OnHover(InputState state)
{
var hoverResult = base.OnHover(state);
if (!SameLinkSprites.Any(sprite => sprite.IsHovered))
foreach (ChatLink sprite in SameLinkSprites)
sprite.TriggerOnHover(state);
Content.FadeColour(hoverColour, 500, Easing.OutQuint);
return hoverResult;
return true;
}
protected override void OnHoverLost(InputState state)
@ -221,9 +220,9 @@ namespace osu.Game.Online.Chat
Content.Colour = urlColour;
}
private class ChatHoverContainer : OsuHoverContainer, ICanDisableHoverSounds
private class ChatHoverContainer : OsuHoverContainer
{
public bool ShouldPlayHoverSound => ((ChatLink)Parent).SameLinkSprites.All(sprite => !sprite.IsHovered);
}
}
}