mirror of
https://github.com/ppy/osu.git
synced 2025-02-06 04:12:55 +08:00
Merge EnableUserDim
and IgnoreUserSettings
to one bindable
This commit is contained in:
parent
84e1ff79a0
commit
36510309d1
@ -142,9 +142,9 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
{
|
{
|
||||||
performFullSetup();
|
performFullSetup();
|
||||||
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
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());
|
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());
|
AddUntilStep("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,10 +161,10 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
player.ReplacesBackground.Value = true;
|
player.ReplacesBackground.Value = true;
|
||||||
player.StoryboardEnabled.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);
|
AddStep("Set dim level to 1", () => songSelect.DimLevel.Value = 1f);
|
||||||
AddUntilStep("Storyboard is invisible", () => !player.IsStoryboardVisible);
|
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);
|
AddUntilStep("Storyboard is visible", () => player.IsStoryboardVisible);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -281,11 +281,11 @@ namespace osu.Game.Tests.Visual.Background
|
|||||||
protected override BackgroundScreen CreateBackground()
|
protected override BackgroundScreen CreateBackground()
|
||||||
{
|
{
|
||||||
background = new FadeAccessibleBackground(Beatmap.Value);
|
background = new FadeAccessibleBackground(Beatmap.Value);
|
||||||
DimEnabled.BindTo(background.EnableUserDim);
|
IgnoreUserSettings.BindTo(background.IgnoreUserSettings);
|
||||||
return background;
|
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> DimLevel = new BindableDouble();
|
||||||
public readonly Bindable<double> BlurLevel = 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;
|
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>
|
/// <summary>
|
||||||
/// 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
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -57,7 +52,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
|
|
||||||
private float breakLightening => LightenDuringBreaks.Value && IsBreakTime.Value ? BREAK_LIGHTEN_AMOUNT : 0;
|
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;
|
protected override Container<Drawable> Content => dimContent;
|
||||||
|
|
||||||
@ -78,7 +73,6 @@ namespace osu.Game.Graphics.Containers
|
|||||||
LightenDuringBreaks = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks);
|
LightenDuringBreaks = config.GetBindable<bool>(OsuSetting.LightenDuringBreaks);
|
||||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
|
|
||||||
EnableUserDim.ValueChanged += _ => UpdateVisuals();
|
|
||||||
UserDimLevel.ValueChanged += _ => UpdateVisuals();
|
UserDimLevel.ValueChanged += _ => UpdateVisuals();
|
||||||
LightenDuringBreaks.ValueChanged += _ => UpdateVisuals();
|
LightenDuringBreaks.ValueChanged += _ => UpdateVisuals();
|
||||||
IsBreakTime.ValueChanged += _ => UpdateVisuals();
|
IsBreakTime.ValueChanged += _ => UpdateVisuals();
|
||||||
|
@ -37,8 +37,7 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
|
|
||||||
public void ApplyToPlayer(Player player)
|
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.DimmableStoryboard.IgnoreUserSettings.Value = true;
|
||||||
|
|
||||||
player.BreakOverlay.Hide();
|
player.BreakOverlay.Hide();
|
||||||
|
@ -27,9 +27,9 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </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>();
|
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||||
|
|
||||||
@ -50,7 +50,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
InternalChild = dimmable = CreateFadeContainer();
|
InternalChild = dimmable = CreateFadeContainer();
|
||||||
|
|
||||||
dimmable.EnableUserDim.BindTo(EnableUserDim);
|
dimmable.IgnoreUserSettings.BindTo(IgnoreUserSettings);
|
||||||
dimmable.IsBreakTime.BindTo(IsBreakTime);
|
dimmable.IsBreakTime.BindTo(IsBreakTime);
|
||||||
dimmable.BlurAmount.BindTo(BlurAmount);
|
dimmable.BlurAmount.BindTo(BlurAmount);
|
||||||
|
|
||||||
@ -148,7 +148,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// As an optimisation, we add the two blur portions to be applied rather than actually applying two separate blurs.
|
/// As an optimisation, we add the two blur portions to be applied rather than actually applying two separate blurs.
|
||||||
/// </summary>
|
/// </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 + (float)userBlurLevel.Value * USER_BLUR_FACTOR)
|
||||||
: new Vector2(BlurAmount.Value);
|
: new Vector2(BlurAmount.Value);
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ namespace osu.Game.Screens.Edit
|
|||||||
// todo: temporary. we want to be applying dim using the UserDimContainer eventually.
|
// todo: temporary. we want to be applying dim using the UserDimContainer eventually.
|
||||||
b.FadeColour(Color4.DarkGray, 500);
|
b.FadeColour(Color4.DarkGray, 500);
|
||||||
|
|
||||||
b.EnableUserDim.Value = false;
|
b.IgnoreUserSettings.Value = true;
|
||||||
b.BlurAmount.Value = 0;
|
b.BlurAmount.Value = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -764,7 +764,7 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
ApplyToBackground(b =>
|
ApplyToBackground(b =>
|
||||||
{
|
{
|
||||||
b.EnableUserDim.Value = true;
|
b.IgnoreUserSettings.Value = false;
|
||||||
b.BlurAmount.Value = 0;
|
b.BlurAmount.Value = 0;
|
||||||
|
|
||||||
// bind component bindables.
|
// bind component bindables.
|
||||||
@ -913,7 +913,7 @@ namespace osu.Game.Screens.Play
|
|||||||
float fadeOutDuration = instant ? 0 : 250;
|
float fadeOutDuration = instant ? 0 : 250;
|
||||||
this.FadeOut(fadeOutDuration);
|
this.FadeOut(fadeOutDuration);
|
||||||
|
|
||||||
ApplyToBackground(b => b.EnableUserDim.Value = false);
|
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
||||||
storyboardReplacesBackground.Value = false;
|
storyboardReplacesBackground.Value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,7 +229,7 @@ namespace osu.Game.Screens.Play
|
|||||||
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
||||||
this.FadeOut(150);
|
this.FadeOut(150);
|
||||||
|
|
||||||
ApplyToBackground(b => b.EnableUserDim.Value = false);
|
ApplyToBackground(b => b.IgnoreUserSettings.Value = true);
|
||||||
|
|
||||||
BackgroundBrightnessReduction = false;
|
BackgroundBrightnessReduction = false;
|
||||||
Beatmap.Value.Track.RemoveAdjustment(AdjustableProperty.Volume, volumeAdjustment);
|
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.
|
// Preview user-defined background dim and blur when hovered on the visual settings panel.
|
||||||
ApplyToBackground(b =>
|
ApplyToBackground(b =>
|
||||||
{
|
{
|
||||||
b.EnableUserDim.Value = true;
|
b.IgnoreUserSettings.Value = false;
|
||||||
b.BlurAmount.Value = 0;
|
b.BlurAmount.Value = 0;
|
||||||
});
|
});
|
||||||
|
|
||||||
@ -288,7 +288,7 @@ namespace osu.Game.Screens.Play
|
|||||||
ApplyToBackground(b =>
|
ApplyToBackground(b =>
|
||||||
{
|
{
|
||||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||||
b.EnableUserDim.Value = false;
|
b.IgnoreUserSettings.Value = true;
|
||||||
b.BlurAmount.Value = BACKGROUND_BLUR;
|
b.BlurAmount.Value = BACKGROUND_BLUR;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user