mirror of
https://github.com/ppy/osu
synced 2024-12-15 03:16:17 +00:00
Merge branch 'visual-settings-container' of https://github.com/nyquillerium/osu into visual-settings-container
This commit is contained in:
commit
bc6e8ce7b4
@ -231,12 +231,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
performFullSetup();
|
||||
AddStep("Move mouse to Visual Settings", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos));
|
||||
AddStep("Resume PlayerLoader", () =>
|
||||
{
|
||||
player.ValidForResume = false;
|
||||
player.RestartRequested?.Invoke();
|
||||
player.Exit();
|
||||
});
|
||||
AddStep("Resume PlayerLoader", () => player.Restart());
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||
|
@ -38,9 +38,9 @@ namespace osu.Game.Graphics.Containers
|
||||
/// </remarks>
|
||||
public readonly Bindable<float> BlurAmount = new Bindable<float>();
|
||||
|
||||
private Bindable<double> dimLevel { get; set; }
|
||||
private Bindable<double> userDimLevel { get; set; }
|
||||
|
||||
private Bindable<double> blurLevel { get; set; }
|
||||
private Bindable<double> userBlurLevel { get; set; }
|
||||
|
||||
private Bindable<bool> showStoryboard { get; set; }
|
||||
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Containers
|
||||
private readonly bool isStoryboard;
|
||||
|
||||
private Vector2 blurTarget => EnableUserDim.Value
|
||||
? new Vector2(BlurAmount.Value + (float)blurLevel.Value * 25)
|
||||
? new Vector2(BlurAmount.Value + (float)userBlurLevel.Value * 25)
|
||||
: new Vector2(BlurAmount.Value);
|
||||
|
||||
private Background background;
|
||||
@ -77,7 +77,7 @@ namespace osu.Game.Graphics.Containers
|
||||
if (drawable is Background b)
|
||||
{
|
||||
background = b;
|
||||
b.BlurTo(blurTarget, 0, Easing.OutQuint);
|
||||
background.BlurTo(blurTarget, 0, Easing.OutQuint);
|
||||
}
|
||||
|
||||
base.Add(drawable);
|
||||
@ -86,12 +86,13 @@ namespace osu.Game.Graphics.Containers
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
blurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
userDimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
userBlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
|
||||
EnableUserDim.ValueChanged += _ => updateVisuals();
|
||||
dimLevel.ValueChanged += _ => updateVisuals();
|
||||
blurLevel.ValueChanged += _ => updateVisuals();
|
||||
userDimLevel.ValueChanged += _ => updateVisuals();
|
||||
userBlurLevel.ValueChanged += _ => updateVisuals();
|
||||
showStoryboard.ValueChanged += _ => updateVisuals();
|
||||
StoryboardReplacesBackground.ValueChanged += _ => updateVisuals();
|
||||
BlurAmount.ValueChanged += _ => updateVisuals();
|
||||
@ -107,7 +108,7 @@ namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
if (isStoryboard)
|
||||
{
|
||||
DimContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint);
|
||||
DimContainer.FadeTo(!showStoryboard.Value || userDimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -120,7 +121,7 @@ namespace osu.Game.Graphics.Containers
|
||||
background?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint);
|
||||
DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)userDimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -112,7 +112,7 @@ namespace osu.Game.Screens.Play
|
||||
PausableGameplayContainer = new PausableGameplayContainer
|
||||
{
|
||||
Retries = RestartCount,
|
||||
OnRetry = restart,
|
||||
OnRetry = Restart,
|
||||
OnQuit = performUserRequestedExit,
|
||||
Start = gameplayClockContainer.Start,
|
||||
Stop = gameplayClockContainer.Stop,
|
||||
@ -154,7 +154,7 @@ namespace osu.Game.Screens.Play
|
||||
},
|
||||
failOverlay = new FailOverlay
|
||||
{
|
||||
OnRetry = restart,
|
||||
OnRetry = Restart,
|
||||
OnQuit = performUserRequestedExit,
|
||||
},
|
||||
new HotkeyRetryOverlay
|
||||
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
fadeOut(true);
|
||||
restart();
|
||||
Restart();
|
||||
},
|
||||
}
|
||||
};
|
||||
@ -235,7 +235,7 @@ namespace osu.Game.Screens.Play
|
||||
this.Exit();
|
||||
}
|
||||
|
||||
private void restart()
|
||||
public void Restart()
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
|
@ -253,16 +253,16 @@ namespace osu.Game.Screens.Play
|
||||
if (!this.IsCurrentScreen())
|
||||
return;
|
||||
|
||||
// We need to perform this check here rather than in OnHover as any number of children of VisualSettings
|
||||
// may also be handling the hover events.
|
||||
if (inputManager.HoveredDrawables.Contains(VisualSettings))
|
||||
{
|
||||
// Acts as an "on hover" trigger for the visual settings panel.
|
||||
// Preview user-defined background dim and blur when hovered on the visual settings panel.
|
||||
Background.EnableUserDim.Value = true;
|
||||
Background.BlurAmount.Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Acts as an "on hover lost" trigger for the visual settings panel.
|
||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
||||
|
Loading…
Reference in New Issue
Block a user