From 1e0a694ff86dc9e942d2adc125b20621e041fb3d Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sun, 19 Feb 2017 17:11:31 +0100 Subject: [PATCH] replaced bool with Bindable Also accounted for the ParallaxAmount when moving to default position --- osu.Game/Graphics/Containers/ParallaxContainer.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 9208c5008a..bc54fd8fdc 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -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 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(OsuConfig.MenuParallax).ValueChanged += delegate + parallaxEnabled = config.GetBindable(OsuConfig.MenuParallax); + parallaxEnabled.ValueChanged += delegate { - parallaxEnabled = config.GetBindable(OsuConfig.MenuParallax); if (!parallaxEnabled) { content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); - content.Scale = Vector2.One; + content.Scale = new Vector2(1 + ParallaxAmount); } }; }