mirror of
https://github.com/osukey/osukey.git
synced 2025-08-02 14:17:06 +09:00
Move user blurring into VIsualSettingsContainer
This commit is contained in:
@ -17,49 +17,12 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
|
||||
|
||||
protected const float BACKGROUND_FADE_DURATION = 800;
|
||||
|
||||
#region User Settings
|
||||
|
||||
protected Bindable<double> BlurLevel;
|
||||
protected Bindable<bool> ShowStoryboard;
|
||||
|
||||
#endregion
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
}
|
||||
|
||||
public override void OnEntering(IScreen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
BlurLevel.ValueChanged += _ => UpdateBackgroundElements();
|
||||
InitializeBackgroundElements();
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
InitializeBackgroundElements();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called once on entering screen. By Default, performs a full <see cref="UpdateBackgroundElements"/> call.
|
||||
/// </summary>
|
||||
protected virtual void InitializeBackgroundElements() => UpdateBackgroundElements();
|
||||
|
||||
/// <summary>
|
||||
/// Called when background elements require updates, usually due to a user changing a setting.
|
||||
/// </summary>
|
||||
/// <param name="userChange"></param>
|
||||
protected virtual void UpdateBackgroundElements()
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user