mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 04:13:00 +08:00
Change to manual adjustment add/remove
This commit is contained in:
parent
85e14f3f0c
commit
0542a45c43
@ -55,6 +55,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private bool backgroundBrightnessReduction;
|
private bool backgroundBrightnessReduction;
|
||||||
|
|
||||||
|
private readonly BindableDouble volumeAdjustment = new BindableDouble(1);
|
||||||
|
|
||||||
protected bool BackgroundBrightnessReduction
|
protected bool BackgroundBrightnessReduction
|
||||||
{
|
{
|
||||||
set
|
set
|
||||||
@ -104,9 +106,6 @@ namespace osu.Game.Screens.Play
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
private AudioManager audioManager { get; set; }
|
private AudioManager audioManager { get; set; }
|
||||||
|
|
||||||
[Resolved]
|
|
||||||
private MusicController musicController { get; set; }
|
|
||||||
|
|
||||||
public PlayerLoader(Func<Player> createPlayer)
|
public PlayerLoader(Func<Player> createPlayer)
|
||||||
{
|
{
|
||||||
this.createPlayer = createPlayer;
|
this.createPlayer = createPlayer;
|
||||||
@ -172,6 +171,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
if (epilepsyWarning != null)
|
if (epilepsyWarning != null)
|
||||||
epilepsyWarning.DimmableBackground = Background;
|
epilepsyWarning.DimmableBackground = Background;
|
||||||
|
Beatmap.Value.Track.AddAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||||
@ -200,6 +200,11 @@ namespace osu.Game.Screens.Play
|
|||||||
cancelLoad();
|
cancelLoad();
|
||||||
|
|
||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
|
|
||||||
|
// we're moving to player, so a period of silence is upcoming.
|
||||||
|
// stop the track before removing adjustment to avoid a volume spike.
|
||||||
|
Beatmap.Value.Track.Stop();
|
||||||
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
@ -211,6 +216,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
Background.EnableUserDim.Value = false;
|
Background.EnableUserDim.Value = false;
|
||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
|
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
@ -335,11 +341,8 @@ namespace osu.Game.Screens.Play
|
|||||||
const double epilepsy_display_length = 3000;
|
const double epilepsy_display_length = 3000;
|
||||||
|
|
||||||
pushSequence
|
pushSequence
|
||||||
.Schedule(() =>
|
.Schedule(() => epilepsyWarning.State.Value = Visibility.Visible)
|
||||||
{
|
.TransformBindableTo(volumeAdjustment, 0.25, EpilepsyWarning.FADE_DURATION, Easing.OutQuint)
|
||||||
musicController.CurrentTrack.VolumeTo(0.25, EpilepsyWarning.FADE_DURATION, Easing.OutQuint);
|
|
||||||
epilepsyWarning.State.Value = Visibility.Visible;
|
|
||||||
})
|
|
||||||
.Delay(epilepsy_display_length)
|
.Delay(epilepsy_display_length)
|
||||||
.Schedule(() =>
|
.Schedule(() =>
|
||||||
{
|
{
|
||||||
@ -359,10 +362,6 @@ namespace osu.Game.Screens.Play
|
|||||||
// Note that this may change if the player we load requested a re-run.
|
// Note that this may change if the player we load requested a re-run.
|
||||||
ValidForResume = false;
|
ValidForResume = false;
|
||||||
|
|
||||||
// restore full volume immediately - there's a usually a period of silence at start of gameplay anyway.
|
|
||||||
// note that this is delayed slightly to avoid volume spikes just before push.
|
|
||||||
musicController.CurrentTrack.Delay(50).VolumeTo(1);
|
|
||||||
|
|
||||||
if (player.LoadedBeatmapSuccessfully)
|
if (player.LoadedBeatmapSuccessfully)
|
||||||
this.Push(player);
|
this.Push(player);
|
||||||
else
|
else
|
||||||
@ -378,10 +377,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private void cancelLoad()
|
private void cancelLoad()
|
||||||
{
|
{
|
||||||
// in case the epilepsy warning is being displayed, restore full volume.
|
|
||||||
if (epilepsyWarning?.IsAlive == true)
|
|
||||||
musicController.CurrentTrack.VolumeTo(1, EpilepsyWarning.FADE_DURATION, Easing.OutQuint);
|
|
||||||
|
|
||||||
scheduledPushPlayer?.Cancel();
|
scheduledPushPlayer?.Cancel();
|
||||||
scheduledPushPlayer = null;
|
scheduledPushPlayer = null;
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user