mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Removed ICanDisableHoverSounds interface
This commit is contained in:
@ -30,8 +30,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
// If Parent does not implement the interface, still play the sample
|
sampleHover?.Play();
|
||||||
if ((Parent as ICanDisableHoverSounds)?.ShouldPlayHoverSound != false) sampleHover?.Play();
|
|
||||||
return base.OnHover(state);
|
return base.OnHover(state);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -51,13 +50,4 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
[Description("-softer")]
|
[Description("-softer")]
|
||||||
Soft
|
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; }
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,7 @@
|
|||||||
using OpenTK.Graphics;
|
using OpenTK.Graphics;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
|
using osu.Framework.Graphics.Colour;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Cursor;
|
using osu.Framework.Graphics.Cursor;
|
||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
@ -180,15 +181,13 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
protected override bool OnHover(InputState state)
|
protected override bool OnHover(InputState state)
|
||||||
{
|
{
|
||||||
var hoverResult = base.OnHover(state);
|
|
||||||
|
|
||||||
if (!SameLinkSprites.Any(sprite => sprite.IsHovered))
|
if (!SameLinkSprites.Any(sprite => sprite.IsHovered))
|
||||||
foreach (ChatLink sprite in SameLinkSprites)
|
foreach (ChatLink sprite in SameLinkSprites)
|
||||||
sprite.TriggerOnHover(state);
|
sprite.TriggerOnHover(state);
|
||||||
|
|
||||||
Content.FadeColour(hoverColour, 500, Easing.OutQuint);
|
Content.FadeColour(hoverColour, 500, Easing.OutQuint);
|
||||||
|
|
||||||
return hoverResult;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void OnHoverLost(InputState state)
|
protected override void OnHoverLost(InputState state)
|
||||||
@ -221,9 +220,9 @@ namespace osu.Game.Online.Chat
|
|||||||
Content.Colour = urlColour;
|
Content.Colour = urlColour;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class ChatHoverContainer : OsuHoverContainer, ICanDisableHoverSounds
|
private class ChatHoverContainer : OsuHoverContainer
|
||||||
{
|
{
|
||||||
public bool ShouldPlayHoverSound => ((ChatLink)Parent).SameLinkSprites.All(sprite => !sprite.IsHovered);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user