mirror of https://github.com/ppy/osu
replaced bool with Bindable<bool>
Also accounted for the ParallaxAmount when moving to default position
This commit is contained in:
parent
7f751d3653
commit
1e0a694ff8
|
@ -9,6 +9,7 @@
|
|||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics.Transformations;
|
||||
using osu.Game.Configuration;
|
||||
using osu.Framework.Configuration;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
|
@ -16,7 +17,7 @@ class ParallaxContainer : Container
|
|||
{
|
||||
public float ParallaxAmount = 0.02f;
|
||||
|
||||
private bool parallaxEnabled = true;
|
||||
private Bindable<bool> parallaxEnabled;
|
||||
|
||||
public override bool Contains(Vector2 screenSpacePos) => true;
|
||||
|
||||
|
@ -40,14 +41,13 @@ public ParallaxContainer()
|
|||
private void load(UserInputManager input, OsuConfigManager config)
|
||||
{
|
||||
this.input = input;
|
||||
|
||||
config.GetBindable<bool>(OsuConfig.MenuParallax).ValueChanged += delegate
|
||||
parallaxEnabled = config.GetBindable<bool>(OsuConfig.MenuParallax);
|
||||
parallaxEnabled.ValueChanged += delegate
|
||||
{
|
||||
parallaxEnabled = config.GetBindable<bool>(OsuConfig.MenuParallax);
|
||||
if (!parallaxEnabled)
|
||||
{
|
||||
content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, EasingTypes.OutQuint);
|
||||
content.Scale = Vector2.One;
|
||||
content.Scale = new Vector2(1 + ParallaxAmount);
|
||||
}
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue