mirror of https://github.com/ppy/osu
Merge pull request #14992 from nekodex/more-filter-effects
Add dynamic filter effect to more places
This commit is contained in:
commit
a924b982eb
|
@ -2,11 +2,13 @@
|
|||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Audio;
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Graphics.Sprites;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
|
@ -20,6 +22,8 @@ public class ManageCollectionsDialog : OsuFocusedOverlayContainer
|
|||
private const double enter_duration = 500;
|
||||
private const double exit_duration = 200;
|
||||
|
||||
private AudioFilter lowPassFilter;
|
||||
|
||||
[Resolved(CanBeNull = true)]
|
||||
private CollectionManager collectionManager { get; set; }
|
||||
|
||||
|
@ -36,7 +40,7 @@ public ManageCollectionsDialog()
|
|||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuColour colours)
|
||||
private void load(OsuColour colours, AudioManager audio)
|
||||
{
|
||||
Children = new Drawable[]
|
||||
{
|
||||
|
@ -108,7 +112,8 @@ private void load(OsuColour colours)
|
|||
},
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
lowPassFilter = new AudioFilter(audio.TrackMixer)
|
||||
};
|
||||
}
|
||||
|
||||
|
@ -116,6 +121,7 @@ protected override void PopIn()
|
|||
{
|
||||
base.PopIn();
|
||||
|
||||
lowPassFilter.CutoffTo(300, 100, Easing.OutCubic);
|
||||
this.FadeIn(enter_duration, Easing.OutQuint);
|
||||
this.ScaleTo(0.9f).Then().ScaleTo(1f, enter_duration, Easing.OutQuint);
|
||||
}
|
||||
|
@ -124,6 +130,8 @@ protected override void PopOut()
|
|||
{
|
||||
base.PopOut();
|
||||
|
||||
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic);
|
||||
|
||||
this.FadeOut(exit_duration, Easing.OutQuint);
|
||||
this.ScaleTo(0.9f, exit_duration);
|
||||
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
using osu.Framework.Logging;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
@ -213,6 +214,9 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
|
|||
|
||||
InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);
|
||||
|
||||
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
|
||||
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
|
||||
|
||||
Score = CreateScore(playableBeatmap);
|
||||
|
||||
// ensure the score is in a consistent state with the current player.
|
||||
|
@ -222,8 +226,6 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
|
|||
|
||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score));
|
||||
|
||||
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
|
||||
|
||||
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
|
||||
|
||||
// load the skinning hierarchy first.
|
||||
|
@ -768,6 +770,8 @@ private void progressToResults(bool withDelay)
|
|||
|
||||
private FailAnimation failAnimation;
|
||||
|
||||
private AudioFilter failLowPassFilter;
|
||||
|
||||
private bool onFail()
|
||||
{
|
||||
if (!CheckModsAllowFailure())
|
||||
|
@ -782,6 +786,7 @@ private bool onFail()
|
|||
if (PauseOverlay.State.Value == Visibility.Visible)
|
||||
PauseOverlay.Hide();
|
||||
|
||||
failLowPassFilter.CutoffTo(300, 2500, Easing.OutCubic);
|
||||
failAnimation.Start();
|
||||
|
||||
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
|
||||
|
@ -794,6 +799,7 @@ private bool onFail()
|
|||
private void onFailComplete()
|
||||
{
|
||||
GameplayClockContainer.Stop();
|
||||
failLowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
|
||||
|
||||
FailOverlay.Retries = RestartCount;
|
||||
FailOverlay.Show();
|
||||
|
|
|
@ -15,6 +15,7 @@
|
|||
using osu.Framework.Input;
|
||||
using osu.Framework.Screens;
|
||||
using osu.Framework.Threading;
|
||||
using osu.Game.Audio.Effects;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Containers;
|
||||
|
@ -63,6 +64,8 @@ public class PlayerLoader : ScreenWithBeatmapBackground
|
|||
|
||||
private readonly BindableDouble volumeAdjustment = new BindableDouble(1);
|
||||
|
||||
private AudioFilter lowPassFilter;
|
||||
|
||||
protected bool BackgroundBrightnessReduction
|
||||
{
|
||||
set
|
||||
|
@ -127,7 +130,7 @@ public PlayerLoader(Func<Player> createPlayer)
|
|||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(SessionStatics sessionStatics)
|
||||
private void load(SessionStatics sessionStatics, AudioManager audio)
|
||||
{
|
||||
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
||||
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
||||
|
@ -159,7 +162,8 @@ private void load(SessionStatics sessionStatics)
|
|||
new InputSettings()
|
||||
}
|
||||
},
|
||||
idleTracker = new IdleTracker(750)
|
||||
idleTracker = new IdleTracker(750),
|
||||
lowPassFilter = new AudioFilter(audio.TrackMixer)
|
||||
});
|
||||
|
||||
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
||||
|
@ -191,6 +195,7 @@ public override void OnEntering(IScreen last)
|
|||
epilepsyWarning.DimmableBackground = b;
|
||||
});
|
||||
|
||||
lowPassFilter.CutoffTo(500, 100, Easing.OutCubic);
|
||||
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
|
||||
content.ScaleTo(0.7f);
|
||||
|
@ -229,6 +234,7 @@ public override void OnSuspending(IScreen next)
|
|||
// stop the track before removing adjustment to avoid a volume spike.
|
||||
Beatmap.Value.Track.Stop();
|
||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
|
||||
}
|
||||
|
||||
public override bool OnExiting(IScreen next)
|
||||
|
@ -242,6 +248,7 @@ public override bool OnExiting(IScreen next)
|
|||
|
||||
BackgroundBrightnessReduction = false;
|
||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic);
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue