mirror of
https://github.com/ppy/osu.git
synced 2024-11-06 06:17:23 +08:00
Merge pull request #12395 from frenzibyte/fix-cinema-ignore-settings
Fix beatmap background displayed if storyboard is hidden on "Cinema" mod
This commit is contained in:
commit
7654df94f6
@ -142,9 +142,9 @@ namespace osu.Game.Tests.Visual.Background
|
||||
{
|
||||
performFullSetup();
|
||||
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
AddStep("Enable user dim", () => songSelect.DimEnabled.Value = false);
|
||||
AddStep("Disable user dim", () => songSelect.IgnoreUserSettings.Value = true);
|
||||
AddUntilStep("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled());
|
||||
AddStep("Disable user dim", () => songSelect.DimEnabled.Value = true);
|
||||
AddStep("Enable user dim", () => songSelect.IgnoreUserSettings.Value = false);
|
||||
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
}
|
||||
|
||||
@ -161,13 +161,36 @@ namespace osu.Game.Tests.Visual.Background
|
||||
player.ReplacesBackground.Value = true;
|
||||
player.StoryboardEnabled.Value = true;
|
||||
});
|
||||
AddStep("Enable user dim", () => player.DimmableStoryboard.EnableUserDim.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.EnableUserDim.Value = false);
|
||||
AddStep("Disable user dim", () => player.DimmableStoryboard.IgnoreUserSettings.Value = true);
|
||||
AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public void TestStoryboardIgnoreUserSettings()
|
||||
{
|
||||
performFullSetup();
|
||||
createFakeStoryboard();
|
||||
AddStep("Enable replacing background", () => player.ReplacesBackground.Value = true);
|
||||
|
||||
AddUntilStep("Storyboard is invisible", () => !player.IsStoryboardVisible);
|
||||
AddUntilStep("Background is visible", () => songSelect.IsBackgroundVisible());
|
||||
|
||||
AddStep("Ignore user settings", () =>
|
||||
{
|
||||
player.ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
||||
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
|
||||
});
|
||||
AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible);
|
||||
AddUntilStep("Background is invisible", () => songSelect.IsBackgroundInvisible());
|
||||
|
||||
AddStep("Disable background replacement", () => player.ReplacesBackground.Value = false);
|
||||
AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible);
|
||||
AddUntilStep("Background is visible", () => songSelect.IsBackgroundVisible());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the visual settings container retains dim and blur when pausing
|
||||
/// </summary>
|
||||
@ -281,11 +304,11 @@ namespace osu.Game.Tests.Visual.Background
|
||||
protected override BackgroundScreen CreateBackground()
|
||||
{
|
||||
background = new FadeAccessibleBackground(Beatmap.Value);
|
||||
DimEnabled.BindTo(background.EnableUserDim);
|
||||
IgnoreUserSettings.BindTo(background.IgnoreUserSettings);
|
||||
return background;
|
||||
}
|
||||
|
||||
public readonly Bindable<bool> DimEnabled = 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();
|
||||
|
||||
|
@ -23,11 +23,6 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
protected const double BACKGROUND_FADE_DURATION = 800;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not user-configured dim levels should be applied to the container.
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>(true);
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not user-configured settings relating to brightness of elements should be ignored
|
||||
/// </summary>
|
||||
@ -57,7 +52,7 @@ namespace osu.Game.Graphics.Containers
|
||||
|
||||
private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0;
|
||||
|
||||
protected float DimLevel => Math.Max(EnableUserDim.Value && !IgnoreUserSettings.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 +73,6 @@ namespace osu.Game.Graphics.Containers
|
||||
LightenDuringBreaks = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks);
|
||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
|
||||
EnableUserDim.ValueChanged += _ => UpdateVisuals();
|
||||
UserDimLevel.ValueChanged += _ => UpdateVisuals();
|
||||
LightenDuringBreaks.ValueChanged += _ => UpdateVisuals();
|
||||
IsBreakTime.ValueChanged += _ => UpdateVisuals();
|
||||
|
@ -37,8 +37,7 @@ namespace osu.Game.Rulesets.Mods
|
||||
|
||||
public void ApplyToPlayer(Player player)
|
||||
{
|
||||
player.ApplyToBackground(b => b.EnableUserDim.Value = false);
|
||||
|
||||
player.ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
||||
player.DimmableStoryboard.IgnoreUserSettings.Value = true;
|
||||
|
||||
player.BreakOverlay.Hide();
|
||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Screens.Backgrounds
|
||||
private WorkingBeatmap beatmap;
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not user dim settings should be applied to this Background.
|
||||
/// Whether or not user-configured settings relating to brightness of elements should be ignored
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>();
|
||||
public readonly Bindable<bool> IgnoreUserSettings = new Bindable<bool>();
|
||||
|
||||
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||
|
||||
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Backgrounds
|
||||
|
||||
InternalChild = dimmable = CreateFadeContainer();
|
||||
|
||||
dimmable.EnableUserDim.BindTo(EnableUserDim);
|
||||
dimmable.IgnoreUserSettings.BindTo(IgnoreUserSettings);
|
||||
dimmable.IsBreakTime.BindTo(IsBreakTime);
|
||||
dimmable.BlurAmount.BindTo(BlurAmount);
|
||||
|
||||
@ -148,7 +148,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 => EnableUserDim.Value
|
||||
private Vector2 blurTarget => !IgnoreUserSettings.Value
|
||||
? new Vector2(BlurAmount.Value + (float)userBlurLevel.Value * USER_BLUR_FACTOR)
|
||||
: new Vector2(BlurAmount.Value);
|
||||
|
||||
@ -166,7 +166,9 @@ namespace osu.Game.Screens.Backgrounds
|
||||
BlurAmount.ValueChanged += _ => UpdateVisuals();
|
||||
}
|
||||
|
||||
protected override bool ShowDimContent => !ShowStoryboard.Value || !StoryboardReplacesBackground.Value; // The background needs to be hidden in the case of it being replaced by the storyboard
|
||||
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 void UpdateVisuals()
|
||||
{
|
||||
|
@ -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.EnableUserDim.Value = false;
|
||||
b.IgnoreUserSettings.Value = true;
|
||||
b.BlurAmount.Value = 0;
|
||||
});
|
||||
|
||||
|
@ -764,7 +764,7 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
ApplyToBackground(b =>
|
||||
{
|
||||
b.EnableUserDim.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.EnableUserDim.Value = false);
|
||||
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
||||
storyboardReplacesBackground.Value = false;
|
||||
}
|
||||
|
||||
|
@ -229,7 +229,7 @@ namespace osu.Game.Screens.Play
|
||||
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
||||
this.FadeOut(150);
|
||||
|
||||
ApplyToBackground(b => b.EnableUserDim.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.EnableUserDim.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.EnableUserDim.Value = false;
|
||||
b.IgnoreUserSettings.Value = true;
|
||||
b.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
});
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user