mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 00:40:09 +09:00
Simplify with an early exit for null sample
This commit is contained in:
@ -48,9 +48,12 @@ 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 && sampleHover != null)
|
if (enoughTimePassedSinceLastPlayback)
|
||||||
{
|
{
|
||||||
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
|
sampleHover.Frequency.Value = 0.96 + RNG.NextDouble(0.08);
|
||||||
sampleHover.Play();
|
sampleHover.Play();
|
||||||
@ -58,7 +61,7 @@ namespace osu.Game.Graphics.UserInterface
|
|||||||
lastPlaybackTime.Value = Time.Current;
|
lastPlaybackTime.Value = Time.Current;
|
||||||
}
|
}
|
||||||
|
|
||||||
return base.OnHover(e);
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user