mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:52:53 +08:00
Improve PlayerLoader
audio and visual transitions
This commit is contained in:
parent
b37096f440
commit
ae4dcbd829
@ -35,6 +35,8 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
protected const float BACKGROUND_BLUR = 15;
|
protected const float BACKGROUND_BLUR = 15;
|
||||||
|
|
||||||
|
private const double content_out_duration = 300;
|
||||||
|
|
||||||
public override bool HideOverlaysOnEnter => hideOverlays;
|
public override bool HideOverlaysOnEnter => hideOverlays;
|
||||||
|
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||||
@ -135,36 +137,39 @@ namespace osu.Game.Screens.Play
|
|||||||
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
muteWarningShownOnce = sessionStatics.GetBindable<bool>(Static.MutedAudioNotificationShownOnce);
|
||||||
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
batteryWarningShownOnce = sessionStatics.GetBindable<bool>(Static.LowBatteryNotificationShownOnce);
|
||||||
|
|
||||||
InternalChild = (content = new LogoTrackingContainer
|
InternalChildren = new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.Centre,
|
(content = new LogoTrackingContainer
|
||||||
Origin = Anchor.Centre,
|
|
||||||
RelativeSizeAxes = Axes.Both,
|
|
||||||
}).WithChildren(new Drawable[]
|
|
||||||
{
|
|
||||||
MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods, content.LogoFacade)
|
|
||||||
{
|
{
|
||||||
Alpha = 0,
|
|
||||||
Anchor = Anchor.Centre,
|
Anchor = Anchor.Centre,
|
||||||
Origin = Anchor.Centre,
|
Origin = Anchor.Centre,
|
||||||
},
|
RelativeSizeAxes = Axes.Both,
|
||||||
PlayerSettings = new FillFlowContainer<PlayerSettingsGroup>
|
}).WithChildren(new Drawable[]
|
||||||
{
|
{
|
||||||
Anchor = Anchor.TopRight,
|
MetadataInfo = new BeatmapMetadataDisplay(Beatmap.Value, Mods, content.LogoFacade)
|
||||||
Origin = Anchor.TopRight,
|
|
||||||
AutoSizeAxes = Axes.Both,
|
|
||||||
Direction = FillDirection.Vertical,
|
|
||||||
Spacing = new Vector2(0, 20),
|
|
||||||
Margin = new MarginPadding(25),
|
|
||||||
Children = new PlayerSettingsGroup[]
|
|
||||||
{
|
{
|
||||||
VisualSettings = new VisualSettings(),
|
Alpha = 0,
|
||||||
new InputSettings()
|
Anchor = Anchor.Centre,
|
||||||
}
|
Origin = Anchor.Centre,
|
||||||
},
|
},
|
||||||
idleTracker = new IdleTracker(750),
|
PlayerSettings = new FillFlowContainer<PlayerSettingsGroup>
|
||||||
|
{
|
||||||
|
Anchor = Anchor.TopRight,
|
||||||
|
Origin = Anchor.TopRight,
|
||||||
|
AutoSizeAxes = Axes.Both,
|
||||||
|
Direction = FillDirection.Vertical,
|
||||||
|
Spacing = new Vector2(0, 20),
|
||||||
|
Margin = new MarginPadding(25),
|
||||||
|
Children = new PlayerSettingsGroup[]
|
||||||
|
{
|
||||||
|
VisualSettings = new VisualSettings(),
|
||||||
|
new InputSettings()
|
||||||
|
}
|
||||||
|
},
|
||||||
|
idleTracker = new IdleTracker(750),
|
||||||
|
}),
|
||||||
lowPassFilter = new AudioFilter(audio.TrackMixer)
|
lowPassFilter = new AudioFilter(audio.TrackMixer)
|
||||||
});
|
};
|
||||||
|
|
||||||
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
if (Beatmap.Value.BeatmapInfo.EpilepsyWarning)
|
||||||
{
|
{
|
||||||
@ -195,7 +200,6 @@ 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);
|
||||||
@ -240,15 +244,15 @@ namespace osu.Game.Screens.Play
|
|||||||
public override bool OnExiting(IScreen next)
|
public override bool OnExiting(IScreen next)
|
||||||
{
|
{
|
||||||
cancelLoad();
|
cancelLoad();
|
||||||
|
contentOut();
|
||||||
|
|
||||||
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
// Ensure the screen doesn't expire until all the outwards fade operations have completed.
|
||||||
this.FadeOut(150);
|
this.Delay(content_out_duration).FadeOut();
|
||||||
|
|
||||||
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
||||||
|
|
||||||
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);
|
||||||
}
|
}
|
||||||
@ -344,6 +348,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
content.FadeInFromZero(400);
|
content.FadeInFromZero(400);
|
||||||
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
content.ScaleTo(1, 650, Easing.OutQuint).Then().Schedule(prepareNewPlayer);
|
||||||
|
lowPassFilter.CutoffTo(1000, 650, Easing.OutQuint);
|
||||||
|
|
||||||
ApplyToBackground(b => b?.FadeColour(Color4.White, 800, Easing.OutQuint));
|
ApplyToBackground(b => b?.FadeColour(Color4.White, 800, Easing.OutQuint));
|
||||||
}
|
}
|
||||||
@ -353,8 +358,9 @@ namespace osu.Game.Screens.Play
|
|||||||
// Ensure the logo is no longer tracking before we scale the content
|
// Ensure the logo is no longer tracking before we scale the content
|
||||||
content.StopTracking();
|
content.StopTracking();
|
||||||
|
|
||||||
content.ScaleTo(0.7f, 300, Easing.InQuint);
|
content.ScaleTo(0.7f, content_out_duration * 2, Easing.OutQuint);
|
||||||
content.FadeOut(250);
|
content.FadeOut(content_out_duration, Easing.OutQuint);
|
||||||
|
lowPassFilter.CutoffTo(AudioFilter.MAX_LOWPASS_CUTOFF, content_out_duration);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void pushWhenLoaded()
|
private void pushWhenLoaded()
|
||||||
@ -381,7 +387,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
contentOut();
|
contentOut();
|
||||||
|
|
||||||
TransformSequence<PlayerLoader> pushSequence = this.Delay(250);
|
TransformSequence<PlayerLoader> pushSequence = this.Delay(content_out_duration);
|
||||||
|
|
||||||
// only show if the warning was created (i.e. the beatmap needs it)
|
// only show if the warning was created (i.e. the beatmap needs it)
|
||||||
// and this is not a restart of the map (the warning expires after first load).
|
// and this is not a restart of the map (the warning expires after first load).
|
||||||
@ -400,6 +406,11 @@ namespace osu.Game.Screens.Play
|
|||||||
})
|
})
|
||||||
.Delay(EpilepsyWarning.FADE_DURATION);
|
.Delay(EpilepsyWarning.FADE_DURATION);
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// This goes hand-in-hand with the restoration of low pass filter in contentOut().
|
||||||
|
this.TransformBindableTo(volumeAdjustment, 0, content_out_duration, Easing.OutCubic);
|
||||||
|
}
|
||||||
|
|
||||||
pushSequence.Schedule(() =>
|
pushSequence.Schedule(() =>
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user