mirror of
https://github.com/ppy/osu.git
synced 2025-03-04 06:12:57 +08:00
Merge branch 'hover-pitch-randomisation' into update-resources
This commit is contained in:
commit
26c9a60b0d
@ -11,6 +11,7 @@ using osu.Framework.Graphics;
|
|||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input.Events;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Framework.Utils;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.UserInterface
|
namespace osu.Game.Graphics.UserInterface
|
||||||
{
|
{
|
||||||
@ -47,15 +48,20 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
protected override bool OnHover(HoverEvent e)
|
||||||
{
|
{
|
||||||
|
if (sampleHover == null)
|
||||||
|
return false;
|
||||||
|
|
||||||
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
bool enoughTimePassedSinceLastPlayback = !lastPlaybackTime.Value.HasValue || Time.Current - lastPlaybackTime.Value >= HoverDebounceTime;
|
||||||
|
|
||||||
if (enoughTimePassedSinceLastPlayback)
|
if (enoughTimePassedSinceLastPlayback)
|
||||||
{
|
{
|
||||||
sampleHover?.Play();
|
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
|
||||||
|
sampleHover.Play();
|
||||||
|
|
||||||
lastPlaybackTime.Value = Time.Current;
|
lastPlaybackTime.Value = Time.Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnHover(e);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user