mirror of https://github.com/ppy/osu
added custom hoverclicksounds so links make sounds on hover&click
This commit is contained in:
parent
174fdf5037
commit
2c67ff75ed
|
@ -16,6 +16,8 @@ public class OsuClickableContainer : ClickableContainer
|
|||
|
||||
protected override Container<Drawable> Content => content;
|
||||
|
||||
protected virtual HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
||||
|
||||
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||
{
|
||||
this.sampleSet = sampleSet;
|
||||
|
@ -33,7 +35,7 @@ private void load()
|
|||
InternalChildren = new Drawable[]
|
||||
{
|
||||
content,
|
||||
new HoverClickSounds(sampleSet)
|
||||
CreateHoverClickSounds(sampleSet)
|
||||
};
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@
|
|||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.UserInterface;
|
||||
using OpenTK;
|
||||
|
||||
namespace osu.Game.Online.Chat
|
||||
|
@ -25,6 +26,8 @@ public class DrawableLinkCompiler : OsuHoverContainer, IHasTooltip
|
|||
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos));
|
||||
|
||||
protected override HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new LinkHoverSounds(sampleSet, Parts);
|
||||
|
||||
public DrawableLinkCompiler(IEnumerable<SpriteText> parts)
|
||||
{
|
||||
Parts = parts.ToList();
|
||||
|
@ -39,5 +42,18 @@ private void load(OsuColour colours)
|
|||
protected override IEnumerable<Drawable> EffectTargets => Parts;
|
||||
|
||||
public string TooltipText { get; set; }
|
||||
|
||||
private class LinkHoverSounds : HoverClickSounds
|
||||
{
|
||||
private readonly List<SpriteText> parts;
|
||||
|
||||
public LinkHoverSounds(HoverSampleSet sampleSet, List<SpriteText> parts)
|
||||
: base(sampleSet)
|
||||
{
|
||||
this.parts = parts;
|
||||
}
|
||||
|
||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue