Fix dual specification of `SuspensionHandler` and move fields around slightly

This commit is contained in:
Dean Herbert 2021-10-07 23:40:47 +09:00
parent 9bf29503fb
commit da96cc73d8
1 changed files with 5 additions and 7 deletions

View File

@ -62,8 +62,6 @@ public abstract class Player : ScreenWithBeatmapBackground, ISamplePlaybackDisab
private readonly Bindable<bool> samplePlaybackDisabled = new Bindable<bool>();
private AudioFilter lowPassFilter;
/// <summary>
/// Whether gameplay should pause when the game window focus is lost.
/// </summary>
@ -217,7 +215,7 @@ private void load(AudioManager audio, OsuConfigManager config, OsuGameBase game)
InternalChild = GameplayClockContainer = CreateGameplayClockContainer(Beatmap.Value, DrawableRuleset.GameplayStartTime);
AddInternal(screenSuspension = new ScreenSuspensionHandler(GameplayClockContainer));
AddInternal(lowPassFilter = new AudioFilter(audio.TrackMixer));
AddInternal(failLowPassFilter = new AudioFilter(audio.TrackMixer));
Score = CreateScore(playableBeatmap);
@ -228,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.
@ -774,6 +770,8 @@ private void progressToResults(bool withDelay)
private FailAnimation failAnimation;
private AudioFilter failLowPassFilter;
private bool onFail()
{
if (!CheckModsAllowFailure())
@ -788,7 +786,7 @@ private bool onFail()
if (PauseOverlay.State.Value == Visibility.Visible)
PauseOverlay.Hide();
lowPassFilter.CutoffTo(300, 2500, Easing.OutCubic);
failLowPassFilter.CutoffTo(300, 2500, Easing.OutCubic);
failAnimation.Start();
if (GameplayState.Mods.OfType<IApplicableFailOverride>().Any(m => m.RestartOnFail))
@ -801,7 +799,7 @@ private bool onFail()
private void onFailComplete()
{
GameplayClockContainer.Stop();
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
failLowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF);
FailOverlay.Retries = RestartCount;
FailOverlay.Show();