Move audio adjustment inside OnResuming

This commit is contained in:
iiSaLMaN 2019-07-04 05:18:29 +03:00
parent 99603ca0b6
commit b53aeec90d
1 changed files with 5 additions and 3 deletions

View File

@ -35,13 +35,16 @@ public class Intro : StartupScreen
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1); private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
[Resolved]
private AudioManager audio { get; set; }
private Bindable<bool> menuVoice; private Bindable<bool> menuVoice;
private Bindable<bool> menuMusic; private Bindable<bool> menuMusic;
private Track track; private Track track;
private WorkingBeatmap introBeatmap; private WorkingBeatmap introBeatmap;
[BackgroundDependencyLoader] [BackgroundDependencyLoader]
private void load(AudioManager audio, OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game) private void load(OsuConfigManager config, BeatmapManager beatmaps, Framework.Game game)
{ {
menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice); menuVoice = config.GetBindable<bool>(OsuSetting.MenuVoice);
menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic); menuMusic = config.GetBindable<bool>(OsuSetting.MenuMusic);
@ -74,8 +77,6 @@ private void load(AudioManager audio, OsuConfigManager config, BeatmapManager be
welcome = audio.Samples.Get(@"welcome"); welcome = audio.Samples.Get(@"welcome");
seeya = audio.Samples.Get(@"seeya"); seeya = audio.Samples.Get(@"seeya");
audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
} }
private const double delay_step_one = 2300; private const double delay_step_one = 2300;
@ -165,6 +166,7 @@ public override void OnResuming(IScreen last)
else else
fadeOutTime = 500; fadeOutTime = 500;
audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit()); this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit());
//don't want to fade out completely else we will stop running updates. //don't want to fade out completely else we will stop running updates.