1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:17:23 +08:00

Revert "Inverse ignore user settings bindable to "apply user settings" instead"

This reverts commit 175b8da2b2.
This commit is contained in:
Salman Ahmed 2021-04-15 08:02:12 +03:00
parent 175b8da2b2
commit 92fd34cea9
9 changed files with 32 additions and 29 deletions

View File

@ -157,9 +157,9 @@ namespace osu.Game.Tests.Visual.Background
{
performFullSetup();
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
AddStep("Disable user dim", () => songSelect.ApplyUserSettings.Value = false);
AddStep("Disable user dim", () => songSelect.IgnoreUserSettings.Value = true);
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled());
AddStep("Enable user dim", () => songSelect.ApplyUserSettings.Value = true);
AddStep("Enable user dim", () => songSelect.IgnoreUserSettings.Value = false);
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
}
@ -176,10 +176,10 @@ namespace osu.Game.Tests.Visual.Background
player.ReplacesBackground.Value = true;
player.StoryboardEnabled.Value = true;
});
AddStep("Enable user dim", () => player.DimmableStoryboard.ApplyUserSettings.Value = true);
AddStep("Enable user dim", () => player.DimmableStoryboard.IgnoreUserSettings.Value = false);
AddStep("Set dim level to 1", () => songSelect.DimLevel.Value = 1f);
AddUntilStep("Storyboard is invisible", () => !player.IsStoryboardVisible);
AddStep("Disable user dim", () => player.DimmableStoryboard.ApplyUserSettings.Value = false);
AddStep("Disable user dim", () => player.DimmableStoryboard.IgnoreUserSettings.Value = true);
AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible);
}
@ -195,8 +195,8 @@ namespace osu.Game.Tests.Visual.Background
AddStep("Ignore user settings", () =>
{
player.ApplyToBackground(b => b.ApplyUserSettings.Value = false);
player.DimmableStoryboard.ApplyUserSettings.Value = false;
player.ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
});
AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible);
AddUntilStep("Background is invisible", () => songSelect.IsBackgroundInvisible());
@ -308,11 +308,11 @@ namespace osu.Game.Tests.Visual.Background
protected override BackgroundScreen CreateBackground()
{
background = new FadeAccessibleBackground(Beatmap.Value);
ApplyUserSettings.BindTo(background.ApplyUserSettings);
IgnoreUserSettings.BindTo(background.IgnoreUserSettings);
return background;
}
public readonly Bindable<bool> ApplyUserSettings = new Bindable<bool>();
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
public readonly Bindable<double> DimLevel = new BindableDouble();
public readonly Bindable<double> BlurLevel = new BindableDouble();

View File

@ -94,7 +94,7 @@ namespace osu.Game.Tests.Visual.Background
AddStep("set dim level 0.6", () => userDimContainer.UserDimLevel.Value = test_user_dim);
AddUntilStep("dim reached", () => userDimContainer.DimEqual(test_user_dim));
AddStep("ignore settings", () => userDimContainer.ApplyUserSettings.Value = false);
AddStep("ignore settings", () => userDimContainer.IgnoreUserSettings.Value = true);
AddUntilStep("no dim", () => userDimContainer.DimEqual(0));
AddStep("set break", () => isBreakTime.Value = true);
AddAssert("no dim", () => userDimContainer.DimEqual(0));

View File

@ -24,9 +24,9 @@ namespace osu.Game.Graphics.Containers
protected const double BACKGROUND_FADE_DURATION = 800;
/// <summary>
/// Whether or not user-configured effect settings should be applied to this container.
/// Whether or not user-configured settings relating to brightness of elements should be ignored
/// </summary>
public readonly Bindable<bool> ApplyUserSettings = new Bindable<bool>(true);
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
/// <summary>
/// Whether or not the storyboard loaded should completely hide the background behind it.
@ -52,7 +52,7 @@ namespace osu.Game.Graphics.Containers
private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0;
protected float DimLevel => Math.Max(ApplyUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : 0, 0);
protected float DimLevel => Math.Max(!IgnoreUserSettings.Value ? (float)UserDimLevel.Value - breakLightening : 0, 0);
protected override Container<Drawable> Content => dimContent;
@ -78,7 +78,7 @@ namespace osu.Game.Graphics.Containers
IsBreakTime.ValueChanged += _ => UpdateVisuals();
ShowStoryboard.ValueChanged += _ => UpdateVisuals();
StoryboardReplacesBackground.ValueChanged += _ => UpdateVisuals();
ApplyUserSettings.ValueChanged += _ => UpdateVisuals();
IgnoreUserSettings.ValueChanged += _ => UpdateVisuals();
}
protected override void LoadComplete()

View File

@ -37,8 +37,8 @@ namespace osu.Game.Rulesets.Mods
public void ApplyToPlayer(Player player)
{
player.ApplyToBackground(b => b.ApplyUserSettings.Value = false);
player.DimmableStoryboard.ApplyUserSettings.Value = false;
player.ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
player.BreakOverlay.Hide();
}

View File

@ -27,9 +27,9 @@ namespace osu.Game.Screens.Backgrounds
private WorkingBeatmap beatmap;
/// <summary>
/// Whether or not user-configured effect settings should be applied to this background screen.
/// Whether or not user-configured settings relating to brightness of elements should be ignored
/// </summary>
public readonly Bindable<bool> ApplyUserSettings = new Bindable<bool>();
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
@ -50,7 +50,10 @@ namespace osu.Game.Screens.Backgrounds
InternalChild = dimmable = CreateFadeContainer();
dimmable.ApplyUserSettings.BindTo(ApplyUserSettings);
// Beatmap background screens should not apply user settings by default.
IgnoreUserSettings.Value = true;
dimmable.IgnoreUserSettings.BindTo(IgnoreUserSettings);
dimmable.IsBreakTime.BindTo(IsBreakTime);
dimmable.BlurAmount.BindTo(BlurAmount);
@ -148,7 +151,7 @@ namespace osu.Game.Screens.Backgrounds
/// <summary>
/// As an optimisation, we add the two blur portions to be applied rather than actually applying two separate blurs.
/// </summary>
private Vector2 blurTarget => ApplyUserSettings.Value
private Vector2 blurTarget => !IgnoreUserSettings.Value
? new Vector2(BlurAmount.Value + (float)userBlurLevel.Value * USER_BLUR_FACTOR)
: new Vector2(BlurAmount.Value);
@ -167,8 +170,8 @@ namespace osu.Game.Screens.Backgrounds
}
protected override bool ShowDimContent
// The background needs to be hidden in the case of it being replaced by the storyboard.
=> (ApplyUserSettings.Value && !ShowStoryboard.Value) || !StoryboardReplacesBackground.Value;
// The background needs to be hidden in the case of it being replaced by the storyboard
=> (!ShowStoryboard.Value && !IgnoreUserSettings.Value) || !StoryboardReplacesBackground.Value;
protected override void UpdateVisuals()
{

View File

@ -467,7 +467,7 @@ namespace osu.Game.Screens.Edit
// todo: temporary. we want to be applying dim using the UserDimContainer eventually.
b.FadeColour(Color4.DarkGray, 500);
b.ApplyUserSettings.Value = false;
b.IgnoreUserSettings.Value = true;
b.BlurAmount.Value = 0;
});

View File

@ -38,14 +38,14 @@ namespace osu.Game.Screens.Play
base.LoadComplete();
}
protected override bool ShowDimContent => !ApplyUserSettings.Value || (ShowStoryboard.Value && DimLevel < 1);
protected override bool ShowDimContent => IgnoreUserSettings.Value || (ShowStoryboard.Value && DimLevel < 1);
private void initializeStoryboard(bool async)
{
if (drawableStoryboard != null)
return;
if (ApplyUserSettings.Value && !ShowStoryboard.Value)
if (!ShowStoryboard.Value && !IgnoreUserSettings.Value)
return;
drawableStoryboard = storyboard.CreateDrawable();

View File

@ -764,7 +764,7 @@ namespace osu.Game.Screens.Play
ApplyToBackground(b =>
{
b.ApplyUserSettings.Value = true;
b.IgnoreUserSettings.Value = false;
b.BlurAmount.Value = 0;
// bind component bindables.
@ -913,7 +913,7 @@ namespace osu.Game.Screens.Play
float fadeOutDuration = instant ? 0 : 250;
this.FadeOut(fadeOutDuration);
ApplyToBackground(b => b.ApplyUserSettings.Value = false);
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
storyboardReplacesBackground.Value = false;
}

View File

@ -229,7 +229,7 @@ namespace osu.Game.Screens.Play
content.ScaleTo(0.7f, 150, Easing.InQuint);
this.FadeOut(150);
ApplyToBackground(b => b.ApplyUserSettings.Value = false);
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
BackgroundBrightnessReduction = false;
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
@ -277,7 +277,7 @@ namespace osu.Game.Screens.Play
// Preview user-defined background dim and blur when hovered on the visual settings panel.
ApplyToBackground(b =>
{
b.ApplyUserSettings.Value = true;
b.IgnoreUserSettings.Value = false;
b.BlurAmount.Value = 0;
});
@ -288,7 +288,7 @@ namespace osu.Game.Screens.Play
ApplyToBackground(b =>
{
// Returns background dim and blur to the values specified by PlayerLoader.
b.ApplyUserSettings.Value = false;
b.IgnoreUserSettings.Value = true;
b.BlurAmount.Value = BACKGROUND_BLUR;
});