1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 10:33:30 +08:00

Merge remote-tracking branch 'upstream/master' into fix-hidden-slider-heads

This commit is contained in:
Dean Herbert 2018-02-28 23:30:49 +09:00
commit b4fb1edfe7
4 changed files with 27 additions and 8 deletions

View File

@ -14,7 +14,9 @@ namespace osu.Game.Graphics.Containers
{
public class ParallaxContainer : Container, IRequireHighFrequencyMousePosition
{
public float ParallaxAmount = 0.02f;
public const float DEFAULT_PARALLAX_AMOUNT = 0.02f;
public float ParallaxAmount = DEFAULT_PARALLAX_AMOUNT;
private Bindable<bool> parallaxEnabled;

View File

@ -52,6 +52,10 @@ namespace osu.Game.Screens
protected readonly Bindable<WorkingBeatmap> Beatmap = new Bindable<WorkingBeatmap>();
protected virtual float BackgroundParallaxAmount => 1;
private ParallaxContainer backgroundParallaxContainer;
public WorkingBeatmap InitialBeatmap
{
set
@ -102,11 +106,10 @@ namespace osu.Game.Screens
protected override void OnResuming(Screen last)
{
base.OnResuming(last);
logo.AppendAnimatingAction(() => LogoArriving(logo, true), true);
sampleExit?.Play();
applyArrivingDefaults(true);
ShowOverlays.Value = ShowOverlaysOnEnter;
base.OnResuming(last);
}
protected override void OnSuspending(Screen next)
@ -123,6 +126,8 @@ namespace osu.Game.Screens
if (lastOsu?.Background != null)
{
backgroundParallaxContainer = lastOsu.backgroundParallaxContainer;
if (bg == null || lastOsu.Background.Equals(bg))
//we can keep the previous mode's background.
Background = lastOsu.Background;
@ -136,7 +141,7 @@ namespace osu.Game.Screens
// this makes up for the fact our padding changes when the global toolbar is visible.
bg.Scale = new Vector2(1.06f);
AddInternal(new ParallaxContainer
AddInternal(backgroundParallaxContainer = new ParallaxContainer
{
Depth = float.MaxValue,
Children = new[]
@ -149,11 +154,9 @@ namespace osu.Game.Screens
if ((logo = lastOsu?.logo) == null)
LoadComponentAsync(logo = new OsuLogo { Alpha = 0 }, AddInternal);
logo.AppendAnimatingAction(() => LogoArriving(logo, false), true);
applyArrivingDefaults(false);
base.OnEntering(last);
ShowOverlays.Value = ShowOverlaysOnEnter;
}
protected override bool OnExiting(Screen next)
@ -193,6 +196,16 @@ namespace osu.Game.Screens
logo.Ripple = true;
}
private void applyArrivingDefaults(bool isResuming)
{
logo.AppendAnimatingAction(() => LogoArriving(logo, isResuming), true);
if (backgroundParallaxContainer != null)
backgroundParallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * BackgroundParallaxAmount;
ShowOverlays.Value = ShowOverlaysOnEnter;
}
private void onExitingLogo()
{
logo.AppendAnimatingAction(() => { LogoExiting(logo); }, false);

View File

@ -37,6 +37,8 @@ namespace osu.Game.Screens.Play
{
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap);
protected override float BackgroundParallaxAmount => 0.1f;
public override bool ShowOverlaysOnEnter => false;
public Action RestartRequested;

View File

@ -386,6 +386,8 @@ namespace osu.Game.Screens.Select
protected override bool OnExiting(Screen next)
{
FinaliseSelection();
beatmapInfoWedge.State = Visibility.Hidden;
Content.FadeOut(100);