mirror of
https://github.com/ppy/osu.git
synced 2025-02-15 23:42:55 +08:00
Improve game exit music fade
This commit is contained in:
parent
d8a25f5247
commit
547c8090e5
@ -46,8 +46,6 @@ namespace osu.Game.Screens.Menu
|
|||||||
|
|
||||||
protected ITrack Track { get; private set; }
|
protected ITrack Track { get; private set; }
|
||||||
|
|
||||||
private readonly BindableDouble exitingVolumeFade = new BindableDouble(1);
|
|
||||||
|
|
||||||
private const int exit_delay = 3000;
|
private const int exit_delay = 3000;
|
||||||
|
|
||||||
private SampleChannel seeya;
|
private SampleChannel seeya;
|
||||||
@ -127,17 +125,29 @@ namespace osu.Game.Screens.Menu
|
|||||||
this.FadeIn(300);
|
this.FadeIn(300);
|
||||||
|
|
||||||
double fadeOutTime = exit_delay;
|
double fadeOutTime = exit_delay;
|
||||||
|
|
||||||
// we also handle the exit transition.
|
// we also handle the exit transition.
|
||||||
if (MenuVoice.Value)
|
if (MenuVoice.Value)
|
||||||
|
{
|
||||||
seeya.Play();
|
seeya.Play();
|
||||||
|
|
||||||
|
// if playing the outro voice, we have more time to have fun with the background track.
|
||||||
|
// initially fade to almost silent then ramp out over the remaining time.
|
||||||
|
const double initial_fade = 200;
|
||||||
|
musicController.CurrentTrack
|
||||||
|
.VolumeTo(0.03f, initial_fade).Then()
|
||||||
|
.VolumeTo(0, fadeOutTime - initial_fade, Easing.In);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
|
{
|
||||||
fadeOutTime = 500;
|
fadeOutTime = 500;
|
||||||
|
|
||||||
audio.AddAdjustment(AdjustableProperty.Volume, exitingVolumeFade);
|
// if outro voice is turned off, just do a simple fade out.
|
||||||
this.TransformBindableTo(exitingVolumeFade, 0, fadeOutTime).OnComplete(_ => this.Exit());
|
musicController.CurrentTrack.VolumeTo(0, fadeOutTime, Easing.Out);
|
||||||
|
}
|
||||||
|
|
||||||
//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.
|
||||||
Game.FadeTo(0.01f, fadeOutTime);
|
Game.FadeTo(0.01f, fadeOutTime).OnComplete(_ => this.Exit());
|
||||||
|
|
||||||
base.OnResuming(last);
|
base.OnResuming(last);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user