mirror of
https://github.com/osukey/osukey.git
synced 2025-05-25 23:47:30 +09:00
added custom hoverclicksounds so links make sounds on hover&click
This commit is contained in:
parent
174fdf5037
commit
2c67ff75ed
@ -16,6 +16,8 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
protected override Container<Drawable> Content => content;
|
protected override Container<Drawable> Content => content;
|
||||||
|
|
||||||
|
protected virtual HoverClickSounds CreateHoverClickSounds(HoverSampleSet sampleSet) => new HoverClickSounds(sampleSet);
|
||||||
|
|
||||||
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
public OsuClickableContainer(HoverSampleSet sampleSet = HoverSampleSet.Normal)
|
||||||
{
|
{
|
||||||
this.sampleSet = sampleSet;
|
this.sampleSet = sampleSet;
|
||||||
@ -33,7 +35,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
InternalChildren = new Drawable[]
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
content,
|
content,
|
||||||
new HoverClickSounds(sampleSet)
|
CreateHoverClickSounds(sampleSet)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -9,6 +9,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
|
using osu.Game.Graphics.UserInterface;
|
||||||
using OpenTK;
|
using OpenTK;
|
||||||
|
|
||||||
namespace osu.Game.Online.Chat
|
namespace osu.Game.Online.Chat
|
||||||
@ -25,6 +26,8 @@ namespace osu.Game.Online.Chat
|
|||||||
|
|
||||||
public override bool ReceiveMouseInputAt(Vector2 screenSpacePos) => Parts.Any(d => d.ReceiveMouseInputAt(screenSpacePos));
|
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)
|
public DrawableLinkCompiler(IEnumerable<SpriteText> parts)
|
||||||
{
|
{
|
||||||
Parts = parts.ToList();
|
Parts = parts.ToList();
|
||||||
@ -39,5 +42,18 @@ namespace osu.Game.Online.Chat
|
|||||||
protected override IEnumerable<Drawable> EffectTargets => Parts;
|
protected override IEnumerable<Drawable> EffectTargets => Parts;
|
||||||
|
|
||||||
public string TooltipText { get; set; }
|
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…
x
Reference in New Issue
Block a user