mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 16:12:57 +08: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();
|
performFullSetup();
|
||||||
AddStep("Move mouse to Visual Settings", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos));
|
AddStep("Move mouse to Visual Settings", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos));
|
||||||
AddStep("Resume PlayerLoader", () =>
|
AddStep("Resume PlayerLoader", () => player.Restart());
|
||||||
{
|
|
||||||
player.ValidForResume = false;
|
|
||||||
player.RestartRequested?.Invoke();
|
|
||||||
player.Exit();
|
|
||||||
});
|
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
AddStep("Move mouse to center of screen", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||||
|
@ -38,9 +38,9 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </remarks>
|
/// </remarks>
|
||||||
public readonly Bindable<float> BlurAmount = new Bindable<float>();
|
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; }
|
private Bindable<bool> showStoryboard { get; set; }
|
||||||
|
|
||||||
@ -51,7 +51,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
private readonly bool isStoryboard;
|
private readonly bool isStoryboard;
|
||||||
|
|
||||||
private Vector2 blurTarget => EnableUserDim.Value
|
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);
|
: new Vector2(BlurAmount.Value);
|
||||||
|
|
||||||
private Background background;
|
private Background background;
|
||||||
@ -77,7 +77,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
if (drawable is Background b)
|
if (drawable is Background b)
|
||||||
{
|
{
|
||||||
background = b;
|
background = b;
|
||||||
b.BlurTo(blurTarget, 0, Easing.OutQuint);
|
background.BlurTo(blurTarget, 0, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
base.Add(drawable);
|
base.Add(drawable);
|
||||||
@ -86,12 +86,13 @@ namespace osu.Game.Graphics.Containers
|
|||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
userDimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
blurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
userBlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
|
|
||||||
EnableUserDim.ValueChanged += _ => updateVisuals();
|
EnableUserDim.ValueChanged += _ => updateVisuals();
|
||||||
dimLevel.ValueChanged += _ => updateVisuals();
|
userDimLevel.ValueChanged += _ => updateVisuals();
|
||||||
blurLevel.ValueChanged += _ => updateVisuals();
|
userBlurLevel.ValueChanged += _ => updateVisuals();
|
||||||
showStoryboard.ValueChanged += _ => updateVisuals();
|
showStoryboard.ValueChanged += _ => updateVisuals();
|
||||||
StoryboardReplacesBackground.ValueChanged += _ => updateVisuals();
|
StoryboardReplacesBackground.ValueChanged += _ => updateVisuals();
|
||||||
BlurAmount.ValueChanged += _ => updateVisuals();
|
BlurAmount.ValueChanged += _ => updateVisuals();
|
||||||
@ -107,7 +108,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
{
|
{
|
||||||
if (isStoryboard)
|
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
|
else
|
||||||
{
|
{
|
||||||
@ -120,7 +121,7 @@ namespace osu.Game.Graphics.Containers
|
|||||||
background?.BlurTo(blurTarget, background_fade_duration, Easing.OutQuint);
|
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
|
PausableGameplayContainer = new PausableGameplayContainer
|
||||||
{
|
{
|
||||||
Retries = RestartCount,
|
Retries = RestartCount,
|
||||||
OnRetry = restart,
|
OnRetry = Restart,
|
||||||
OnQuit = performUserRequestedExit,
|
OnQuit = performUserRequestedExit,
|
||||||
Start = gameplayClockContainer.Start,
|
Start = gameplayClockContainer.Start,
|
||||||
Stop = gameplayClockContainer.Stop,
|
Stop = gameplayClockContainer.Stop,
|
||||||
@ -154,7 +154,7 @@ namespace osu.Game.Screens.Play
|
|||||||
},
|
},
|
||||||
failOverlay = new FailOverlay
|
failOverlay = new FailOverlay
|
||||||
{
|
{
|
||||||
OnRetry = restart,
|
OnRetry = Restart,
|
||||||
OnQuit = performUserRequestedExit,
|
OnQuit = performUserRequestedExit,
|
||||||
},
|
},
|
||||||
new HotkeyRetryOverlay
|
new HotkeyRetryOverlay
|
||||||
@ -164,7 +164,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
fadeOut(true);
|
fadeOut(true);
|
||||||
restart();
|
Restart();
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
@ -235,7 +235,7 @@ namespace osu.Game.Screens.Play
|
|||||||
this.Exit();
|
this.Exit();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void restart()
|
public void Restart()
|
||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
|
|
||||||
|
@ -253,16 +253,16 @@ namespace osu.Game.Screens.Play
|
|||||||
if (!this.IsCurrentScreen())
|
if (!this.IsCurrentScreen())
|
||||||
return;
|
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))
|
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.
|
// Preview user-defined background dim and blur when hovered on the visual settings panel.
|
||||||
Background.EnableUserDim.Value = true;
|
Background.EnableUserDim.Value = true;
|
||||||
Background.BlurAmount.Value = 0;
|
Background.BlurAmount.Value = 0;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Acts as an "on hover lost" trigger for the visual settings panel.
|
|
||||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||||
Background.EnableUserDim.Value = false;
|
Background.EnableUserDim.Value = false;
|
||||||
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
||||||
|
Loading…
Reference in New Issue
Block a user