Split click and hover and disable click debounce

This commit is contained in:
phosphene47
2019-11-28 00:44:01 +11:00
parent d4afea0b5e
commit 786fb9ede3
2 changed files with 11 additions and 6 deletions

View File

@ -21,6 +21,11 @@ namespace osu.Game.Graphics.UserInterface
private SampleChannel sampleClick;
private readonly MouseButton[] buttons;
/// <summary>
/// Length of debounce for click sound playback, in milliseconds. Default is 0ms.
/// </summary>
public double ClickDebounceTime { get; set; }
/// <summary>
/// a container which plays sounds on hover and click for any specified <see cref="MouseButton"/>s.
/// </summary>
@ -43,10 +48,10 @@ namespace osu.Game.Graphics.UserInterface
if (buttons.Contains(e.Button) && Contains(e.ScreenSpaceMousePosition))
{
if (DebounceTime <= 0)
if (ClickDebounceTime <= 0)
sampleClick?.Play();
else
playDelegate = Scheduler.AddDelayed(() => sampleClick?.Play(), DebounceTime);
playDelegate = Scheduler.AddDelayed(() => sampleClick?.Play(), ClickDebounceTime);
}
return base.OnClick(e);