diff --git a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs index 270d544dcf..181f1ecb47 100644 --- a/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs +++ b/osu.Game/Screens/Edit/Timing/MetronomeDisplay.cs @@ -4,6 +4,7 @@ #nullable disable using System; +using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Audio; using osu.Framework.Audio.Sample; @@ -14,6 +15,7 @@ using osu.Framework.Graphics; using osu.Framework.Graphics.Colour; using osu.Framework.Graphics.Containers; using osu.Framework.Graphics.Shapes; +using osu.Framework.Threading; using osu.Framework.Timing; using osu.Framework.Utils; using osu.Game.Beatmaps.ControlPoints; @@ -37,6 +39,9 @@ namespace osu.Game.Screens.Edit.Timing private Sample clunk; + [CanBeNull] + private ScheduledDelegate clunkDelegate; + [Resolved] private OverlayColourProvider overlayColourProvider { get; set; } @@ -258,6 +263,9 @@ namespace osu.Game.Screens.Edit.Timing } isSwinging = false; + + clunkDelegate?.Cancel(); + clunkDelegate = null; } } @@ -283,7 +291,7 @@ namespace osu.Game.Screens.Edit.Timing { stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint); - Schedule(() => + clunkDelegate = Schedule(() => { if (!EnableClicking) return;