1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-13 20:07:25 +08:00

Merge branch 'master' into random-seed-max-input-length

This commit is contained in:
Dan Balasescu 2021-10-08 15:38:42 +09:00 committed by GitHub
commit 67cfe3412e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 7 deletions

View File

@ -10,7 +10,9 @@ using osu.Framework.Allocation;
using osu.Framework.Audio.Sample; using osu.Framework.Audio.Sample;
using osu.Framework.Audio.Track; using osu.Framework.Audio.Track;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
using osu.Framework.Utils; using osu.Framework.Utils;
using osu.Game.Audio.Effects;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.Objects.Drawables;
using osuTK; using osuTK;
@ -22,7 +24,7 @@ namespace osu.Game.Screens.Play
/// Manage the animation to be applied when a player fails. /// Manage the animation to be applied when a player fails.
/// Single file; automatically disposed after use. /// Single file; automatically disposed after use.
/// </summary> /// </summary>
public class FailAnimation : Component public class FailAnimation : CompositeDrawable
{ {
public Action OnComplete; public Action OnComplete;
@ -32,6 +34,8 @@ namespace osu.Game.Screens.Play
private Track track; private Track track;
private AudioFilter failLowPassFilter;
private const float duration = 2500; private const float duration = 2500;
private Sample failSample; private Sample failSample;
@ -46,6 +50,8 @@ namespace osu.Game.Screens.Play
{ {
track = beatmap.Value.Track; track = beatmap.Value.Track;
failSample = audio.Samples.Get(@"Gameplay/failsound"); failSample = audio.Samples.Get(@"Gameplay/failsound");
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
} }
private bool started; private bool started;
@ -68,6 +74,8 @@ namespace osu.Game.Screens.Play
Expire(); Expire();
}); });
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq); track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
applyToPlayfield(drawableRuleset.Playfield); applyToPlayfield(drawableRuleset.Playfield);

View File

@ -15,7 +15,6 @@ using osu.Framework.Input.Events;
using osu.Framework.Logging; using osu.Framework.Logging;
using osu.Framework.Screens; using osu.Framework.Screens;
using osu.Framework.Threading; using osu.Framework.Threading;
using osu.Game.Audio.Effects;
using osu.Game.Beatmaps; using osu.Game.Beatmaps;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Game.Graphics.Containers; using osu.Game.Graphics.Containers;
@ -215,7 +214,6 @@ namespace osu.Game.Screens.Play
InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime); InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer)); AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
Score = CreateScore(playableBeatmap); Score = CreateScore(playableBeatmap);
@ -770,8 +768,6 @@ namespace osu.Game.Screens.Play
private FailAnimation failAnimation; private FailAnimation failAnimation;
private AudioFilter failLowPassFilter;
private bool onFail() private bool onFail()
{ {
if (!CheckModsAllowFailure()) if (!CheckModsAllowFailure())
@ -786,7 +782,6 @@ namespace osu.Game.Screens.Play
if (PauseOverlay.State.Value == Visibility.Visible) if (PauseOverlay.State.Value == Visibility.Visible)
PauseOverlay.Hide(); PauseOverlay.Hide();
failLowPassFilter.CutoffTo(300, 2500, Easing.OutCubic);
failAnimation.Start(); failAnimation.Start();
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail)) if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
@ -799,7 +794,6 @@ namespace osu.Game.Screens.Play
private void onFailComplete() private void onFailComplete()
{ {
GameplayClockContainer.Stop(); GameplayClockContainer.Stop();
failLowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
FailOverlay.Retries = RestartCount; FailOverlay.Retries = RestartCount;
FailOverlay.Show(); FailOverlay.Show();