mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 16:29:58 +09:00
Split click and hover and disable click debounce
This commit is contained in:
@ -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);
|
||||
|
Reference in New Issue
Block a user