Add a new test for OsuScreenStack, fix parallax

This commit is contained in:
David Zhao
2019-03-22 14:10:38 +09:00
parent ee0d7b6c6d
commit dcae86e39a
5 changed files with 59 additions and 13 deletions

View File

@ -15,6 +15,8 @@ namespace osu.Game.Screens
private ParallaxContainer parallaxContainer;
protected float ParallaxAmount => parallaxContainer.ParallaxAmount;
public OsuScreenStack()
{
initializeStack();
@ -35,11 +37,15 @@ namespace osu.Game.Screens
};
ScreenPushed += setParallax;
ScreenExited += setParallax;
}
private void setParallax(IScreen prev, IScreen next)
{
parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount;
if (next != null)
{
parallaxContainer.ParallaxAmount = ParallaxContainer.DEFAULT_PARALLAX_AMOUNT * ((IOsuScreen)next).BackgroundParallaxAmount;
}
}
}
}