From f166bb0f96b28e0b269326aae4cf4c7888bd97b6 Mon Sep 17 00:00:00 2001 From: Jorolf Date: Sat, 18 Feb 2017 22:26:48 +0100 Subject: [PATCH] Moved movement to the default position to property --- .../Graphics/Containers/ParallaxContainer.cs | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/osu.Game/Graphics/Containers/ParallaxContainer.cs b/osu.Game/Graphics/Containers/ParallaxContainer.cs index 328d74994e..3cf2e0f413 100644 --- a/osu.Game/Graphics/Containers/ParallaxContainer.cs +++ b/osu.Game/Graphics/Containers/ParallaxContainer.cs @@ -15,7 +15,24 @@ namespace osu.Game.Graphics.Containers class ParallaxContainer : Container { public float ParallaxAmount = 0.02f; - public bool ParallaxEnabled = true; + + private bool parallaxEnabled = true; + public bool ParallaxEnabled + { + get + { + return parallaxEnabled; + } + set + { + parallaxEnabled = value; + if (!parallaxEnabled) + { + content.MoveTo(Vector2.Zero, 1000, EasingTypes.OutQuint); + content.Scale = Vector2.One; + } + } + } public override bool Contains(Vector2 screenSpacePos) => true; @@ -43,11 +60,6 @@ private void load(UserInputManager input, OsuConfigManager config) config.GetBindable(OsuConfig.MenuParallax).ValueChanged += delegate { ParallaxEnabled = config.GetBindable(OsuConfig.MenuParallax); - if (!ParallaxEnabled) - { - content.MoveTo(Vector2.Zero, 1000, EasingTypes.OutQuint); - content.Scale = Vector2.One; - } }; }