replaced bool with Bindable<bool>

Also accounted for the ParallaxAmount when moving to default position
This commit is contained in:
Jorolf 2017-02-19 17:11:31 +01:00
parent 7f751d3653
commit 1e0a694ff8
1 changed files with 5 additions and 5 deletions

View File

@ -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
{
if (!parallaxEnabled)
{
content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, EasingTypes.OutQuint);
content.Scale = Vector2.One;
content.Scale = new Vector2(1 + ParallaxAmount);
}
};
}