mirror of
https://github.com/ppy/osu.git
synced 2024-11-11 14:17:26 +08:00
Update FailAnimation
to use SkinnableSound
This commit is contained in:
parent
f91af8fa64
commit
1d5e596615
@ -1,15 +1,13 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// 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.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Audio;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Game.Rulesets.UI;
|
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using ManagedBass.Fx;
|
using ManagedBass.Fx;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Audio.Sample;
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Audio.Track;
|
using osu.Framework.Audio.Track;
|
||||||
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Extensions.Color4Extensions;
|
using osu.Framework.Extensions.Color4Extensions;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
@ -21,6 +19,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Rulesets.Objects.Drawables;
|
using osu.Game.Rulesets.Objects.Drawables;
|
||||||
|
using osu.Game.Rulesets.UI;
|
||||||
using osu.Game.Skinning;
|
using osu.Game.Skinning;
|
||||||
using osuTK;
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
@ -50,8 +49,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private const float duration = 2500;
|
private const float duration = 2500;
|
||||||
|
|
||||||
private ISample? failSample;
|
private SkinnableSound failSample = null!;
|
||||||
private SampleChannel? failSampleChannel;
|
|
||||||
|
|
||||||
[Resolved]
|
[Resolved]
|
||||||
private OsuConfigManager config { get; set; } = null!;
|
private OsuConfigManager config { get; set; } = null!;
|
||||||
@ -76,10 +74,10 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(AudioManager audio, ISkinSource skin, IBindable<WorkingBeatmap> beatmap)
|
private void load(AudioManager audio, IBindable<WorkingBeatmap> beatmap)
|
||||||
{
|
{
|
||||||
track = beatmap.Value.Track;
|
track = beatmap.Value.Track;
|
||||||
failSample = skin.GetSample(new SampleInfo(@"Gameplay/failsound"));
|
AddInternal(failSample = new SkinnableSound(new SampleInfo("Gameplay/failsound")));
|
||||||
|
|
||||||
AddRangeInternal(new Drawable[]
|
AddRangeInternal(new Drawable[]
|
||||||
{
|
{
|
||||||
@ -126,7 +124,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
failHighPassFilter.CutoffTo(300);
|
failHighPassFilter.CutoffTo(300);
|
||||||
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
|
failLowPassFilter.CutoffTo(300, duration, Easing.OutCubic);
|
||||||
failSampleChannel = failSample?.Play();
|
failSample.Play();
|
||||||
|
|
||||||
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
|
track.AddAdjustment(AdjustableProperty.Frequency, trackFreq);
|
||||||
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
@ -159,7 +157,7 @@ namespace osu.Game.Screens.Play
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stop()
|
public void Stop()
|
||||||
{
|
{
|
||||||
failSampleChannel?.Stop();
|
failSample.Stop();
|
||||||
removeFilters();
|
removeFilters();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user