mirror of
https://github.com/ppy/osu.git
synced 2025-02-13 14:13:18 +08:00
Apply NRT to FailAnimation
This commit is contained in:
parent
8f4a953d11
commit
ec60e16439
@ -1,14 +1,11 @@
|
||||
// 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 osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using JetBrains.Annotations;
|
||||
using ManagedBass.Fx;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio.Sample;
|
||||
@ -34,27 +31,27 @@ namespace osu.Game.Screens.Play
|
||||
/// </summary>
|
||||
public class FailAnimation : Container
|
||||
{
|
||||
public Action OnComplete;
|
||||
public Action? OnComplete;
|
||||
|
||||
private readonly DrawableRuleset drawableRuleset;
|
||||
private readonly BindableDouble trackFreq = new BindableDouble(1);
|
||||
private readonly BindableDouble volumeAdjustment = new BindableDouble(0.5);
|
||||
|
||||
private Container filters;
|
||||
private Container filters = null!;
|
||||
|
||||
private Box redFlashLayer;
|
||||
private Box redFlashLayer = null!;
|
||||
|
||||
private Track track;
|
||||
private Track? track;
|
||||
|
||||
private AudioFilter failLowPassFilter;
|
||||
private AudioFilter failHighPassFilter;
|
||||
private AudioFilter failLowPassFilter = null!;
|
||||
private AudioFilter failHighPassFilter = null!;
|
||||
|
||||
private const float duration = 2500;
|
||||
|
||||
private Sample failSample;
|
||||
private Sample? failSample;
|
||||
|
||||
[Resolved]
|
||||
private OsuConfigManager config { get; set; }
|
||||
private OsuConfigManager config { get; set; } = null!;
|
||||
|
||||
protected override Container<Drawable> Content { get; } = new Container
|
||||
{
|
||||
@ -66,8 +63,7 @@ namespace osu.Game.Screens.Play
|
||||
/// <summary>
|
||||
/// The player screen background, used to adjust appearance on failing.
|
||||
/// </summary>
|
||||
[CanBeNull]
|
||||
public BackgroundScreen Background { private get; set; }
|
||||
public BackgroundScreen? Background { private get; set; }
|
||||
|
||||
public FailAnimation(DrawableRuleset drawableRuleset)
|
||||
{
|
||||
@ -127,7 +123,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
failHighPassFilter.CutoffTo(300);
|
||||
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
|
||||
failSample.Play();
|
||||
failSample?.Play();
|
||||
|
||||
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
|
||||
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
|
Loading…
Reference in New Issue
Block a user