Merge branch 'master' into new-metronome-sfx

This commit is contained in:
Dean Herbert
2022-06-21 14:58:58 +09:00
3516 changed files with 7941 additions and 961 deletions

View File

@ -1,7 +1,10 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
#nullable disable
using System;
using JetBrains.Annotations;
using osu.Framework.Allocation;
using osu.Framework.Audio;
using osu.Framework.Audio.Sample;
@ -38,11 +41,19 @@ namespace osu.Game.Screens.Edit.Timing
private Sample tickDownbeat;
private Sample latch;
[CanBeNull]
private ScheduledDelegate clunkDelegate;
[Resolved]
private OverlayColourProvider overlayColourProvider { get; set; }
public bool EnableClicking { get; set; } = true;
public MetronomeDisplay()
{
AllowMistimedEventFiring = false;
}
[BackgroundDependencyLoader]
private void load(AudioManager audio)
{
@ -256,8 +267,12 @@ namespace osu.Game.Screens.Edit.Timing
{
swing.ClearTransforms(true);
stick.FadeColour(overlayColourProvider.Colour2, 1000, Easing.OutQuint);
isSwinging = false;
clunkDelegate?.Cancel();
clunkDelegate = null;
// instantly latch if pendulum arm is close enough to center (to prevent awkward delayed playback of latch sound)
if (Precision.AlmostEquals(swing.Rotation, 0, 1))
{
@ -301,7 +316,7 @@ namespace osu.Game.Screens.Edit.Timing
{
stick.FlashColour(overlayColourProvider.Content1, beatLength, Easing.OutQuint);
Schedule(() =>
clunkDelegate = Schedule(() =>
{
if (!EnableClicking)
return;