mirror of
https://github.com/osukey/osukey.git
synced 2025-07-01 08:20:00 +09:00
Move user dim logic into UserDimContainer instead
This commit is contained in:
36
osu.Game/Graphics/Containers/UserDimContainer.cs
Normal file
36
osu.Game/Graphics/Containers/UserDimContainer.cs
Normal file
@ -0,0 +1,36 @@
|
||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||
// See the LICENCE file in the repository root for full licence text.
|
||||
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Configuration;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Configuration;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
public class UserDimContainer : Container
|
||||
{
|
||||
#region User Settings
|
||||
|
||||
protected Bindable<double> DimLevel;
|
||||
|
||||
#endregion
|
||||
|
||||
public Bindable<bool> EnableUserDim = new Bindable<bool>();
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
DimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
EnableUserDim.ValueChanged += _ => updateBackgroundDim();
|
||||
DimLevel.ValueChanged += _ => updateBackgroundDim();
|
||||
}
|
||||
|
||||
private void updateBackgroundDim()
|
||||
{
|
||||
this.FadeColour(EnableUserDim ? OsuColour.Gray(1 - (float)DimLevel) : Color4.White, 800, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user