diff --git a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs index 5df5337a96..566ccd6bd5 100644 --- a/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs +++ b/osu.Game.Tests/Visual/Background/TestSceneUserDimBackgrounds.cs @@ -125,13 +125,13 @@ namespace osu.Game.Tests.Visual.Background createFakeStoryboard(); AddStep("Enable Storyboard", () => { - player.ReplacesBackground.Value = true; + player.StoryboardReplacesBackground.Value = true; player.StoryboardEnabled.Value = true; }); - AddUntilStep("Background is invisible, storyboard is visible", () => songSelect.IsBackgroundInvisible() && player.IsStoryboardVisible); + AddUntilStep("Background is black, storyboard is visible", () => songSelect.IsBackgroundVisible() && songSelect.IsBackgroundBlack() && player.IsStoryboardVisible); AddStep("Disable Storyboard", () => { - player.ReplacesBackground.Value = false; + player.StoryboardReplacesBackground.Value = false; player.StoryboardEnabled.Value = false; }); AddUntilStep("Background is visible, storyboard is invisible", () => songSelect.IsBackgroundVisible() && !player.IsStoryboardVisible); @@ -173,7 +173,7 @@ namespace osu.Game.Tests.Visual.Background createFakeStoryboard(); AddStep("Enable Storyboard", () => { - player.ReplacesBackground.Value = true; + player.StoryboardReplacesBackground.Value = true; player.StoryboardEnabled.Value = true; }); AddStep("Enable user dim", () => player.DimmableStoryboard.IgnoreUserSettings.Value = false); @@ -188,7 +188,7 @@ namespace osu.Game.Tests.Visual.Background { performFullSetup(); createFakeStoryboard(); - AddStep("Enable replacing background", () => player.ReplacesBackground.Value = true); + AddStep("Enable replacing background", () => player.StoryboardReplacesBackground.Value = true); AddUntilStep("Storyboard is invisible", () => !player.IsStoryboardVisible); AddUntilStep("Background is visible", () => songSelect.IsBackgroundVisible()); @@ -199,11 +199,11 @@ namespace osu.Game.Tests.Visual.Background player.DimmableStoryboard.IgnoreUserSettings.Value = true; }); AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible); - AddUntilStep("Background is invisible", () => songSelect.IsBackgroundInvisible()); + AddUntilStep("Background is dimmed", () => songSelect.IsBackgroundVisible() && songSelect.IsBackgroundBlack()); - AddStep("Disable background replacement", () => player.ReplacesBackground.Value = false); + AddStep("Disable background replacement", () => player.StoryboardReplacesBackground.Value = false); AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible); - AddUntilStep("Background is visible", () => songSelect.IsBackgroundVisible()); + AddUntilStep("Background is visible", () => songSelect.IsBackgroundVisible() && !songSelect.IsBackgroundBlack()); } /// @@ -257,7 +257,7 @@ namespace osu.Game.Tests.Visual.Background private void createFakeStoryboard() => AddStep("Create storyboard", () => { player.StoryboardEnabled.Value = false; - player.ReplacesBackground.Value = false; + player.StoryboardReplacesBackground.Value = false; player.DimmableStoryboard.Add(new OsuSpriteText { Size = new Vector2(500, 50), @@ -323,6 +323,8 @@ namespace osu.Game.Tests.Visual.Background config.BindWith(OsuSetting.BlurLevel, BlurLevel); } + public bool IsBackgroundBlack() => background.CurrentColour == OsuColour.Gray(0); + public bool IsBackgroundDimmed() => background.CurrentColour == OsuColour.Gray(1f - background.CurrentDim); public bool IsBackgroundUndimmed() => background.CurrentColour == Color4.White; @@ -331,8 +333,6 @@ namespace osu.Game.Tests.Visual.Background public bool IsUserBlurDisabled() => background.CurrentBlur == new Vector2(0); - public bool IsBackgroundInvisible() => background.CurrentAlpha == 0; - public bool IsBackgroundVisible() => background.CurrentAlpha == 1; public bool IsBackgroundBlur() => Precision.AlmostEquals(background.CurrentBlur, new Vector2(BACKGROUND_BLUR), 0.1f); @@ -367,7 +367,7 @@ namespace osu.Game.Tests.Visual.Background { base.OnEntering(e); - ApplyToBackground(b => ReplacesBackground.BindTo(b.StoryboardReplacesBackground)); + ApplyToBackground(b => StoryboardReplacesBackground.BindTo(b.StoryboardReplacesBackground)); } public new DimmableStoryboard DimmableStoryboard => base.DimmableStoryboard; @@ -376,7 +376,7 @@ namespace osu.Game.Tests.Visual.Background public bool BlockLoad; public Bindable StoryboardEnabled; - public readonly Bindable ReplacesBackground = new Bindable(); + public readonly Bindable StoryboardReplacesBackground = new Bindable(); public readonly Bindable IsPaused = new Bindable(); public LoadBlockingTestPlayer(bool allowPause = true) diff --git a/osu.Game/Graphics/Containers/UserDimContainer.cs b/osu.Game/Graphics/Containers/UserDimContainer.cs index 4821e6b370..625702ef6e 100644 --- a/osu.Game/Graphics/Containers/UserDimContainer.cs +++ b/osu.Game/Graphics/Containers/UserDimContainer.cs @@ -24,8 +24,11 @@ namespace osu.Game.Graphics.Containers public const double BACKGROUND_FADE_DURATION = 800; /// - /// Whether or not user-configured settings relating to brightness of elements should be ignored + /// Whether or not user-configured settings relating to brightness of elements should be ignored. /// + /// + /// For best or worst, this also bypasses storyboard disable. Not sure this is correct but leaving it as to not break anything. + /// public readonly Bindable IgnoreUserSettings = new Bindable(); /// @@ -52,7 +55,7 @@ namespace osu.Game.Graphics.Containers private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0; - protected float DimLevel => Math.Max(!IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : DimWhenUserSettingsIgnored.Value, 0); + protected virtual float DimLevel => Math.Max(!IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : DimWhenUserSettingsIgnored.Value, 0); protected override Container Content => dimContent; diff --git a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs index 8a3755f980..1506b884b4 100644 --- a/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs +++ b/osu.Game/Screens/Backgrounds/BackgroundScreenBeatmap.cs @@ -194,9 +194,16 @@ namespace osu.Game.Screens.Backgrounds StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals(); } - protected override bool ShowDimContent - // The background needs to be hidden in the case of it being replaced by the storyboard - => (!ShowStoryboard.Value && !IgnoreUserSettings.Value) || !StoryboardReplacesBackground.Value; + protected override float DimLevel + { + get + { + if ((IgnoreUserSettings.Value || ShowStoryboard.Value) && StoryboardReplacesBackground.Value) + return 1; + + return base.DimLevel; + } + } protected override void UpdateVisuals() {