1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 08:12:56 +08:00

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

View File

@ -9,6 +9,7 @@ using osu.Framework;
using osu.Framework.Allocation; using osu.Framework.Allocation;
using osu.Framework.Graphics.Transformations; using osu.Framework.Graphics.Transformations;
using osu.Game.Configuration; using osu.Game.Configuration;
using osu.Framework.Configuration;
namespace osu.Game.Graphics.Containers namespace osu.Game.Graphics.Containers
{ {
@ -16,7 +17,7 @@ namespace osu.Game.Graphics.Containers
{ {
public float ParallaxAmount = 0.02f; public float ParallaxAmount = 0.02f;
private bool parallaxEnabled = true; private Bindable<bool> parallaxEnabled;
public override bool Contains(Vector2 screenSpacePos) => true; public override bool Contains(Vector2 screenSpacePos) => true;
@ -40,14 +41,13 @@ namespace osu.Game.Graphics.Containers
private void load(UserInputManager input, OsuConfigManager config) private void load(UserInputManager input, OsuConfigManager config)
{ {
this.input = input; this.input = input;
parallaxEnabled = config.GetBindable<bool>(OsuConfig.MenuParallax);
config.GetBindable<bool>(OsuConfig.MenuParallax).ValueChanged += delegate parallaxEnabled.ValueChanged += delegate
{ {
parallaxEnabled = config.GetBindable<bool>(OsuConfig.MenuParallax);
if (!parallaxEnabled) if (!parallaxEnabled)
{ {
content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, EasingTypes.OutQuint); content.MoveTo(Vector2.Zero, firstUpdate ? 0 : 1000, EasingTypes.OutQuint);
content.Scale = Vector2.One; content.Scale = new Vector2(1 + ParallaxAmount);
} }
}; };
} }