mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 00:53:56 +09:00
Merge pull request #14992 from nekodex/more-filter-effects
Add dynamic filter effect to more places
This commit is contained in:
@ -2,11 +2,13 @@
|
|||||||
// 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.Allocation;
|
using osu.Framework.Allocation;
|
||||||
|
using osu.Framework.Audio;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Shapes;
|
using osu.Framework.Graphics.Shapes;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
|
using osu.Game.Audio.Effects;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
using osu.Game.Graphics.Sprites;
|
using osu.Game.Graphics.Sprites;
|
||||||
@ -20,6 +22,8 @@ namespace osu.Game.Collections
|
|||||||
private const double enter_duration = 500;
|
private const double enter_duration = 500;
|
||||||
private const double exit_duration = 200;
|
private const double exit_duration = 200;
|
||||||
|
|
||||||
|
private AudioFilter lowPassFilter;
|
||||||
|
|
||||||
[Resolved(CanBeNull = true)]
|
[Resolved(CanBeNull = true)]
|
||||||
private CollectionManager collectionManager { get; set; }
|
private CollectionManager collectionManager { get; set; }
|
||||||
|
|
||||||
@ -36,7 +40,7 @@ namespace osu.Game.Collections
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuColour colours)
|
private void load(OsuColour colours, AudioManager audio)
|
||||||
{
|
{
|
||||||
Children = new Drawable[]
|
Children = new Drawable[]
|
||||||
{
|
{
|
||||||
@ -108,7 +112,8 @@ namespace osu.Game.Collections
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
},
|
||||||
|
lowPassFilter = new AudioFilter(audio.TrackMixer)
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -116,6 +121,7 @@ namespace osu.Game.Collections
|
|||||||
{
|
{
|
||||||
base.PopIn();
|
base.PopIn();
|
||||||
|
|
||||||
|
lowPassFilter.CutoffTo(300, 100, Easing.OutCubic);
|
||||||
this.FadeIn(enter_duration, Easing.OutQuint);
|
this.FadeIn(enter_duration, Easing.OutQuint);
|
||||||
this.ScaleTo(0.9f).Then().ScaleTo(1f, enter_duration, Easing.OutQuint);
|
this.ScaleTo(0.9f).Then().ScaleTo(1f, enter_duration, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
@ -124,6 +130,8 @@ namespace osu.Game.Collections
|
|||||||
{
|
{
|
||||||
base.PopOut();
|
base.PopOut();
|
||||||
|
|
||||||
|
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic);
|
||||||
|
|
||||||
this.FadeOut(exit_duration, Easing.OutQuint);
|
this.FadeOut(exit_duration, Easing.OutQuint);
|
||||||
this.ScaleTo(0.9f, exit_duration);
|
this.ScaleTo(0.9f, exit_duration);
|
||||||
|
|
||||||
|
@ -15,6 +15,7 @@ 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;
|
||||||
@ -213,6 +214,9 @@ 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(failLowPassFilter = new AudioFilter(audio.TrackMixer));
|
||||||
|
|
||||||
Score = CreateScore(playableBeatmap);
|
Score = CreateScore(playableBeatmap);
|
||||||
|
|
||||||
// ensure the score is in a consistent state with the current player.
|
// ensure the score is in a consistent state with the current player.
|
||||||
@ -222,8 +226,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score));
|
dependencies.CacheAs(GameplayState = new GameplayState(playableBeatmap, ruleset, gameplayMods, Score));
|
||||||
|
|
||||||
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
|
|
||||||
|
|
||||||
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
|
var rulesetSkinProvider = new RulesetSkinProvidingContainer(ruleset, playableBeatmap, Beatmap.Value.Skin);
|
||||||
|
|
||||||
// load the skinning hierarchy first.
|
// load the skinning hierarchy first.
|
||||||
@ -768,6 +770,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private FailAnimation failAnimation;
|
private FailAnimation failAnimation;
|
||||||
|
|
||||||
|
private AudioFilter failLowPassFilter;
|
||||||
|
|
||||||
private bool onFail()
|
private bool onFail()
|
||||||
{
|
{
|
||||||
if (!CheckModsAllowFailure())
|
if (!CheckModsAllowFailure())
|
||||||
@ -782,6 +786,7 @@ 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))
|
||||||
@ -794,6 +799,7 @@ 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();
|
||||||
|
@ -15,6 +15,7 @@ using osu.Framework.Graphics.Transforms;
|
|||||||
using osu.Framework.Input;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
|
using osu.Game.Audio.Effects;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Containers;
|
using osu.Game.Graphics.Containers;
|
||||||
@ -63,6 +64,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private readonly BindableDouble volumeAdjustment = new BindableDouble(1);
|
private readonly BindableDouble volumeAdjustment = new BindableDouble(1);
|
||||||
|
|
||||||
|
private AudioFilter lowPassFilter;
|
||||||
|
|
||||||
protected bool BackgroundBrightnessReduction
|
protected bool BackgroundBrightnessReduction
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -127,7 +130,7 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(SessionStatics sessionStatics)
|
private void load(SessionStatics sessionStatics, AudioManager audio)
|
||||||
{
|
{
|
||||||
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
||||||
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
||||||
@ -159,7 +162,8 @@ namespace osu.Game.Screens.Play
|
|||||||
new InputSettings()
|
new InputSettings()
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
idleTracker = new IdleTracker(750)
|
idleTracker = new IdleTracker(750),
|
||||||
|
lowPassFilter = new AudioFilter(audio.TrackMixer)
|
||||||
});
|
});
|
||||||
|
|
||||||
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
||||||
@ -191,6 +195,7 @@ namespace osu.Game.Screens.Play
|
|||||||
epilepsyWarning.DimmableBackground = b;
|
epilepsyWarning.DimmableBackground = b;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
lowPassFilter.CutoffTo(500, 100, Easing.OutCubic);
|
||||||
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
@ -229,6 +234,7 @@ namespace osu.Game.Screens.Play
|
|||||||
// stop the track before removing adjustment to avoid a volume spike.
|
// stop the track before removing adjustment to avoid a volume spike.
|
||||||
Beatmap.Value.Track.Stop();
|
Beatmap.Value.Track.Stop();
|
||||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
@ -242,6 +248,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, 100, Easing.InCubic);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user