mirror of
https://github.com/ppy/osu
synced 2025-01-02 04:12:13 +00:00
Move user blurring into VIsualSettingsContainer
This commit is contained in:
parent
13f84e8d50
commit
de6d8fc637
@ -43,13 +43,13 @@ namespace osu.Game.Tests.Visual
|
||||
typeof(ScreenWithBeatmapBackground),
|
||||
typeof(PlayerLoader),
|
||||
typeof(Player),
|
||||
typeof(UserDimContainer),
|
||||
typeof(VisualSettingsContainer),
|
||||
typeof(OsuScreen)
|
||||
};
|
||||
|
||||
private DummySongSelect songSelect;
|
||||
private DimAccessiblePlayerLoader playerLoader;
|
||||
private DimAccessiblePlayer player;
|
||||
private TestPlayerLoader playerLoader;
|
||||
private TestPlayer player;
|
||||
private DatabaseContextFactory factory;
|
||||
private BeatmapManager manager;
|
||||
private RulesetStore rulesets;
|
||||
@ -91,13 +91,13 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if <see cref="PlayerLoader"/> properly triggers background dim previews when a user hovers over the visual settings panel.
|
||||
/// Check if <see cref="PlayerLoader"/> properly triggers the visual settings preview when a user hovers over the visual settings panel.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void PlayerLoaderSettingsHoverTest()
|
||||
{
|
||||
setupUserSettings();
|
||||
AddStep("Start player loader", () => songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer())));
|
||||
AddStep("Start player loader", () => songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer())));
|
||||
AddUntilStep(() => playerLoader?.IsLoaded ?? false, "Wait for Player Loader to load");
|
||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
||||
AddStep("Trigger background preview", () =>
|
||||
@ -106,16 +106,16 @@ namespace osu.Game.Tests.Visual
|
||||
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
||||
});
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||
waitForDim();
|
||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
||||
AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// In the case of a user triggering the dim preview the instant player gets loaded, then moving the cursor off of the visual settings:
|
||||
/// The OnHover of PlayerLoader will trigger, which could potentially trigger an undim unless checked for in PlayerLoader.
|
||||
/// We need to check that in this scenario, the dim is still properly applied after entering player.
|
||||
/// The OnHover of PlayerLoader will trigger, which could potentially cause visual settings to be unapplied unless checked for in PlayerLoader.
|
||||
/// We need to check that in this scenario, the dim and blur is still properly applied after entering player.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void PlayerLoaderTransitionTest()
|
||||
@ -124,7 +124,7 @@ namespace osu.Game.Tests.Visual
|
||||
AddStep("Trigger hover event", () => playerLoader.TriggerOnHover());
|
||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed and unblurred", () => songSelect.IsBackgroundDimmed() && songSelect.IsBackgroundUnblurred());
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@ -165,24 +165,24 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the <see cref="UserDimContainer"/> is properly accepting user dim changes at all.
|
||||
/// Check if the <see cref="VisualSettingsContainer"/> is properly accepting user-defined visual changes at all.
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void DisableUserDimTest()
|
||||
{
|
||||
performFullSetup();
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
AddStep("EnableUserDim disabled", () => songSelect.DimEnabled.Value = false);
|
||||
waitForDim();
|
||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
||||
AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled());
|
||||
AddStep("EnableUserDim enabled", () => songSelect.DimEnabled.Value = true);
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the fade container retains dim when pausing
|
||||
/// Check if the visual settings container retains dim and blur when pausing
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void PauseTest()
|
||||
@ -190,14 +190,14 @@ namespace osu.Game.Tests.Visual
|
||||
performFullSetup(true);
|
||||
AddStep("Pause", () => player.CurrentPausableGameplayContainer.Pause());
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
AddStep("Unpause", () => player.CurrentPausableGameplayContainer.Resume());
|
||||
waitForDim();
|
||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
||||
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if the fade container removes user dim when suspending <see cref="Player"/> for <see cref="SoloResults"/>
|
||||
/// Check if the visual settings container removes user dim when suspending <see cref="Player"/> for <see cref="SoloResults"/>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TransitionTest()
|
||||
@ -205,11 +205,12 @@ namespace osu.Game.Tests.Visual
|
||||
performFullSetup();
|
||||
AddStep("Transition to Results", () => player.Push(new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } })));
|
||||
waitForDim();
|
||||
AddAssert("Screen is undimmed and is original background", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent());
|
||||
AddAssert("Screen is undimmed, original background retained", () =>
|
||||
songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && songSelect.IsUserBlurDisabled());
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Check if background gets undimmed when leaving <see cref="Player"/> for <see cref="PlaySongSelect"/>
|
||||
/// Check if background gets undimmed and unblurred when leaving <see cref="Player"/> for <see cref="PlaySongSelect"/>
|
||||
/// </summary>
|
||||
[Test]
|
||||
public void TransitionOutTest()
|
||||
@ -217,7 +218,7 @@ namespace osu.Game.Tests.Visual
|
||||
performFullSetup();
|
||||
AddStep("Exit to song select", () => player.Exit());
|
||||
waitForDim();
|
||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
||||
AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsUserBlurDisabled());
|
||||
}
|
||||
|
||||
private void waitForDim() => AddWaitStep(5, "Wait for dim");
|
||||
@ -243,7 +244,7 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
AddStep("Start player loader", () =>
|
||||
{
|
||||
songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer
|
||||
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer
|
||||
{
|
||||
AllowPause = allowPause,
|
||||
Ready = true,
|
||||
@ -261,7 +262,7 @@ namespace osu.Game.Tests.Visual
|
||||
{
|
||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() });
|
||||
songSelect.DimLevel.Value = 0.7f;
|
||||
songSelect.BlurLevel.Value = 0.0f;
|
||||
songSelect.BlurLevel.Value = 0.4f;
|
||||
});
|
||||
}
|
||||
|
||||
@ -270,7 +271,7 @@ namespace osu.Game.Tests.Visual
|
||||
protected override BackgroundScreen CreateBackground()
|
||||
{
|
||||
FadeAccessibleBackground background = new FadeAccessibleBackground(Beatmap.Value);
|
||||
DimEnabled.BindTo(background.EnableUserDim);
|
||||
DimEnabled.BindTo(background.EnableVisualSettings);
|
||||
return background;
|
||||
}
|
||||
|
||||
@ -289,10 +290,12 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value);
|
||||
|
||||
public bool IsBackgroundUnblurred() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(0);
|
||||
|
||||
public bool IsBackgroundUndimmed() => ((FadeAccessibleBackground)Background).CurrentColour == Color4.White;
|
||||
|
||||
public bool IsUserBlurApplied() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2((float)BlurLevel.Value * 25);
|
||||
|
||||
public bool IsUserBlurDisabled() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(0);
|
||||
|
||||
public bool IsBackgroundInvisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 0;
|
||||
|
||||
public bool IsBackgroundVisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 1;
|
||||
@ -314,23 +317,23 @@ namespace osu.Game.Tests.Visual
|
||||
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
||||
}
|
||||
|
||||
private class DimAccessiblePlayer : Player
|
||||
private class TestPlayer : Player
|
||||
{
|
||||
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
||||
|
||||
protected override UserDimContainer CreateStoryboardContainer()
|
||||
protected override VisualSettingsContainer CreateStoryboardContainer()
|
||||
{
|
||||
return new TestUserDimContainer(true)
|
||||
return new TestVisualSettingsContainer(true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 1,
|
||||
EnableUserDim = { Value = true }
|
||||
EnableVisualSettings = { Value = true }
|
||||
};
|
||||
}
|
||||
|
||||
public PausableGameplayContainer CurrentPausableGameplayContainer => PausableGameplayContainer;
|
||||
|
||||
public UserDimContainer CurrentStoryboardContainer => StoryboardContainer;
|
||||
public VisualSettingsContainer CurrentStoryboardContainer => StoryboardContainer;
|
||||
|
||||
// Whether or not the player should be allowed to load.
|
||||
public bool Ready;
|
||||
@ -339,9 +342,9 @@ namespace osu.Game.Tests.Visual
|
||||
public readonly Bindable<bool> ReplacesBackground = new Bindable<bool>();
|
||||
public readonly Bindable<bool> IsPaused = new Bindable<bool>();
|
||||
|
||||
public bool IsStoryboardVisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha == 1;
|
||||
public bool IsStoryboardVisible() => ((TestVisualSettingsContainer)CurrentStoryboardContainer).CurrentAlpha == 1;
|
||||
|
||||
public bool IsStoryboardInvisible() => ((TestUserDimContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
|
||||
public bool IsStoryboardInvisible() => ((TestVisualSettingsContainer)CurrentStoryboardContainer).CurrentAlpha <= 1;
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
@ -368,12 +371,12 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
}
|
||||
|
||||
private class DimAccessiblePlayerLoader : PlayerLoader
|
||||
private class TestPlayerLoader : PlayerLoader
|
||||
{
|
||||
public VisualSettings VisualSettingsPos => VisualSettings;
|
||||
public BackgroundScreen ScreenPos => Background;
|
||||
|
||||
public DimAccessiblePlayerLoader(Player player)
|
||||
public TestPlayerLoader(Player player)
|
||||
: base(() => player)
|
||||
{
|
||||
}
|
||||
@ -385,14 +388,15 @@ namespace osu.Game.Tests.Visual
|
||||
|
||||
private class FadeAccessibleBackground : BackgroundScreenBeatmap
|
||||
{
|
||||
protected override UserDimContainer CreateFadeContainer() => fadeContainer = new TestUserDimContainer { RelativeSizeAxes = Axes.Both };
|
||||
protected override VisualSettingsContainer CreateFadeContainer() => fadeContainer = new TestVisualSettingsContainer { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
public Color4 CurrentColour => fadeContainer.CurrentColour;
|
||||
|
||||
public float CurrentAlpha => fadeContainer.CurrentAlpha;
|
||||
|
||||
public Vector2 CurrentBlur => Background.BlurSigma;
|
||||
public Vector2 CurrentBlur => fadeContainer.CurrentBlur;
|
||||
|
||||
private TestUserDimContainer fadeContainer;
|
||||
private TestVisualSettingsContainer fadeContainer;
|
||||
|
||||
public FadeAccessibleBackground(WorkingBeatmap beatmap)
|
||||
: base(beatmap)
|
||||
@ -400,12 +404,14 @@ namespace osu.Game.Tests.Visual
|
||||
}
|
||||
}
|
||||
|
||||
private class TestUserDimContainer : UserDimContainer
|
||||
private class TestVisualSettingsContainer : VisualSettingsContainer
|
||||
{
|
||||
public Color4 CurrentColour => DimContainer.Colour;
|
||||
public float CurrentAlpha => DimContainer.Alpha;
|
||||
public Color4 CurrentColour => LocalContainer.Colour;
|
||||
public float CurrentAlpha => LocalContainer.Alpha;
|
||||
|
||||
public TestUserDimContainer(bool isStoryboard = false)
|
||||
public Vector2 CurrentBlur => LocalContainer.BlurSigma;
|
||||
|
||||
public TestVisualSettingsContainer(bool isStoryboard = false)
|
||||
: base(isStoryboard)
|
||||
{
|
||||
}
|
||||
|
@ -6,83 +6,93 @@ using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Containers;
|
||||
using osu.Game.Configuration;
|
||||
using osuTK;
|
||||
using osuTK.Graphics;
|
||||
|
||||
namespace osu.Game.Graphics.Containers
|
||||
{
|
||||
/// <summary>
|
||||
/// A container that applies user-configured dim levels to its contents.
|
||||
/// A container that applies user-configured visual settings to its contents.
|
||||
/// This container specifies behavior that applies to both Storyboards and Backgrounds.
|
||||
/// </summary>
|
||||
public class UserDimContainer : Container
|
||||
public class VisualSettingsContainer : Container
|
||||
{
|
||||
private const float background_fade_duration = 800;
|
||||
|
||||
private Bindable<double> dimLevel { get; set; }
|
||||
|
||||
private Bindable<double> blurLevel { get; set; }
|
||||
|
||||
private Bindable<bool> showStoryboard { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not user-configured dim levels should be applied to the container.
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>();
|
||||
public readonly Bindable<bool> EnableVisualSettings = new Bindable<bool>();
|
||||
|
||||
/// <summary>
|
||||
/// Whether or not the storyboard loaded should completely hide the background behind it.
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||
|
||||
protected Container DimContainer { get; }
|
||||
protected BufferedContainer LocalContainer { get; }
|
||||
|
||||
protected override Container<Drawable> Content => DimContainer;
|
||||
protected override Container<Drawable> Content => LocalContainer;
|
||||
|
||||
private readonly bool isStoryboard;
|
||||
|
||||
private Vector2 returnBlur;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="UserDimContainer"/>.
|
||||
/// Creates a new <see cref="VisualSettingsContainer"/>.
|
||||
/// </summary>
|
||||
/// <param name="isStoryboard"> Whether or not this instance of UserDimContainer contains a storyboard.
|
||||
/// <param name="isStoryboard"> Whether or not this instance contains a storyboard.
|
||||
/// <remarks>
|
||||
/// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via <see cref="showStoryboard"/>
|
||||
/// and can cause backgrounds to become hidden via <see cref="StoryboardReplacesBackground"/>.
|
||||
/// and can cause backgrounds to become hidden via <see cref="StoryboardReplacesBackground"/>. Storyboards are also currently unable to be blurred.
|
||||
/// </remarks>
|
||||
/// </param>
|
||||
public UserDimContainer(bool isStoryboard = false)
|
||||
public VisualSettingsContainer(bool isStoryboard = false)
|
||||
{
|
||||
this.isStoryboard = isStoryboard;
|
||||
AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both });
|
||||
AddInternal(LocalContainer = new BufferedContainer { RelativeSizeAxes = Axes.Both });
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||
blurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
EnableUserDim.ValueChanged += _ => updateBackgroundDim();
|
||||
dimLevel.ValueChanged += _ => updateBackgroundDim();
|
||||
showStoryboard.ValueChanged += _ => updateBackgroundDim();
|
||||
StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim();
|
||||
EnableVisualSettings.ValueChanged += _ => updateVisuals();
|
||||
dimLevel.ValueChanged += _ => updateVisuals();
|
||||
blurLevel.ValueChanged += _ => updateVisuals();
|
||||
showStoryboard.ValueChanged += _ => updateVisuals();
|
||||
StoryboardReplacesBackground.ValueChanged += _ => updateVisuals();
|
||||
}
|
||||
|
||||
protected override void LoadComplete()
|
||||
{
|
||||
base.LoadComplete();
|
||||
updateBackgroundDim();
|
||||
updateVisuals();
|
||||
}
|
||||
|
||||
private void updateBackgroundDim()
|
||||
private void updateVisuals()
|
||||
{
|
||||
if (isStoryboard)
|
||||
{
|
||||
DimContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint);
|
||||
LocalContainer.FadeTo(!showStoryboard.Value || dimLevel.Value == 1 ? 0 : 1, background_fade_duration, Easing.OutQuint);
|
||||
}
|
||||
else
|
||||
{
|
||||
// The background needs to be hidden in the case of it being replaced by the storyboard
|
||||
DimContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint);
|
||||
LocalContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, background_fade_duration, Easing.OutQuint);
|
||||
|
||||
// Only blur if this container contains a background
|
||||
LocalContainer.BlurTo(EnableVisualSettings.Value ? new Vector2((float)blurLevel.Value * 25) : new Vector2(0), background_fade_duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
DimContainer.FadeColour(EnableUserDim.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint);
|
||||
LocalContainer.FadeColour(EnableVisualSettings.Value ? OsuColour.Gray(1 - (float)dimLevel.Value) : Color4.White, background_fade_duration, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
@ -8,6 +8,7 @@ using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
using osu.Game.Graphics.Containers;
|
||||
using osuTK;
|
||||
|
||||
namespace osu.Game.Screens.Backgrounds
|
||||
{
|
||||
@ -18,13 +19,13 @@ namespace osu.Game.Screens.Backgrounds
|
||||
/// <summary>
|
||||
/// Whether or not user dim settings should be applied to this Background.
|
||||
/// </summary>
|
||||
public readonly Bindable<bool> EnableUserDim = new Bindable<bool>();
|
||||
public readonly Bindable<bool> EnableVisualSettings = new Bindable<bool>();
|
||||
|
||||
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||
|
||||
private readonly UserDimContainer fadeContainer;
|
||||
private readonly VisualSettingsContainer fadeContainer;
|
||||
|
||||
protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both };
|
||||
protected virtual VisualSettingsContainer CreateFadeContainer() => new VisualSettingsContainer { RelativeSizeAxes = Axes.Both };
|
||||
|
||||
public virtual WorkingBeatmap Beatmap
|
||||
{
|
||||
@ -62,7 +63,7 @@ namespace osu.Game.Screens.Backgrounds
|
||||
{
|
||||
Beatmap = beatmap;
|
||||
InternalChild = fadeContainer = CreateFadeContainer();
|
||||
fadeContainer.EnableUserDim.BindTo(EnableUserDim);
|
||||
fadeContainer.EnableVisualSettings.BindTo(EnableVisualSettings);
|
||||
}
|
||||
|
||||
public override bool Equals(BackgroundScreen other)
|
||||
|
@ -71,13 +71,13 @@ namespace osu.Game.Screens.Play
|
||||
private FailOverlay failOverlay;
|
||||
|
||||
private DrawableStoryboard storyboard;
|
||||
protected UserDimContainer StoryboardContainer { get; private set; }
|
||||
protected VisualSettingsContainer StoryboardContainer { get; private set; }
|
||||
|
||||
protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true)
|
||||
protected virtual VisualSettingsContainer CreateStoryboardContainer() => new VisualSettingsContainer(true)
|
||||
{
|
||||
RelativeSizeAxes = Axes.Both,
|
||||
Alpha = 1,
|
||||
EnableUserDim = { Value = true }
|
||||
EnableVisualSettings = { Value = true }
|
||||
};
|
||||
|
||||
public bool LoadedBeatmapSuccessfully => RulesetContainer?.Objects.Any() == true;
|
||||
@ -318,7 +318,7 @@ namespace osu.Game.Screens.Play
|
||||
if (enabled.NewValue) initializeStoryboard(true);
|
||||
};
|
||||
|
||||
Background.EnableUserDim.Value = true;
|
||||
Background.EnableVisualSettings.Value = true;
|
||||
|
||||
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||
StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||
@ -365,7 +365,7 @@ namespace osu.Game.Screens.Play
|
||||
float fadeOutDuration = instant ? 0 : 250;
|
||||
this.FadeOut(fadeOutDuration);
|
||||
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.EnableVisualSettings.Value = false;
|
||||
storyboardReplacesBackground.Value = false;
|
||||
}
|
||||
|
||||
|
@ -26,8 +26,9 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
public class PlayerLoader : ScreenWithBeatmapBackground
|
||||
{
|
||||
protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(15);
|
||||
|
||||
private readonly Func<Player> createPlayer;
|
||||
private static readonly Vector2 background_blur = new Vector2(15);
|
||||
|
||||
private Player player;
|
||||
|
||||
@ -118,12 +119,16 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
private void contentIn()
|
||||
{
|
||||
Background?.BlurTo(BACKGROUND_BLUR, 800, Easing.OutQuint);
|
||||
|
||||
content.ScaleTo(1, 650, Easing.OutQuint);
|
||||
content.FadeInFromZero(400);
|
||||
}
|
||||
|
||||
private void contentOut()
|
||||
{
|
||||
Background?.BlurTo(new Vector2(0), 800, Easing.OutQuint);
|
||||
|
||||
content.ScaleTo(0.7f, 300, Easing.InQuint);
|
||||
content.FadeOut(250);
|
||||
}
|
||||
@ -133,6 +138,7 @@ namespace osu.Game.Screens.Play
|
||||
base.OnEntering(last);
|
||||
|
||||
content.ScaleTo(0.7f);
|
||||
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||
|
||||
contentIn();
|
||||
|
||||
@ -158,11 +164,10 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected override bool OnHover(HoverEvent e)
|
||||
{
|
||||
// restore our screen defaults
|
||||
if (this.IsCurrentScreen())
|
||||
{
|
||||
InitializeBackgroundElements();
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.BlurTo(BACKGROUND_BLUR, 800, Easing.OutQuint);
|
||||
Background.EnableVisualSettings.Value = false;
|
||||
}
|
||||
|
||||
return base.OnHover(e);
|
||||
@ -172,22 +177,16 @@ namespace osu.Game.Screens.Play
|
||||
{
|
||||
if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true)
|
||||
{
|
||||
// Update background elements is only being called here because blur logic still exists in Player.
|
||||
// Will need to be removed when resolving https://github.com/ppy/osu/issues/4322
|
||||
UpdateBackgroundElements();
|
||||
if (this.IsCurrentScreen())
|
||||
Background.EnableUserDim.Value = true;
|
||||
if (this.IsCurrentScreen() && Background != null)
|
||||
{
|
||||
Background.BlurTo(new Vector2(0), 800, Easing.OutQuint);
|
||||
Background.EnableVisualSettings.Value = true;
|
||||
}
|
||||
}
|
||||
|
||||
base.OnHoverLost(e);
|
||||
}
|
||||
|
||||
protected override void InitializeBackgroundElements()
|
||||
{
|
||||
Background?.FadeColour(Color4.White, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
Background?.BlurTo(background_blur, BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void pushWhenLoaded()
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
@ -250,7 +249,7 @@ namespace osu.Game.Screens.Play
|
||||
this.FadeOut(150);
|
||||
cancelLoad();
|
||||
|
||||
Background.EnableUserDim.Value = false;
|
||||
Background.EnableVisualSettings.Value = false;
|
||||
|
||||
return base.OnExiting(next);
|
||||
}
|
||||
|
@ -17,49 +17,12 @@ namespace osu.Game.Screens.Play
|
||||
|
||||
protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
|
||||
|
||||
protected const float BACKGROUND_FADE_DURATION = 800;
|
||||
|
||||
#region User Settings
|
||||
|
||||
protected Bindable<double> BlurLevel;
|
||||
protected Bindable<bool> ShowStoryboard;
|
||||
|
||||
#endregion
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
private void load(OsuConfigManager config)
|
||||
{
|
||||
BlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||
ShowStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||
}
|
||||
|
||||
public override void OnEntering(IScreen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
BlurLevel.ValueChanged += _ => UpdateBackgroundElements();
|
||||
InitializeBackgroundElements();
|
||||
}
|
||||
|
||||
public override void OnResuming(IScreen last)
|
||||
{
|
||||
base.OnResuming(last);
|
||||
InitializeBackgroundElements();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Called once on entering screen. By Default, performs a full <see cref="UpdateBackgroundElements"/> call.
|
||||
/// </summary>
|
||||
protected virtual void InitializeBackgroundElements() => UpdateBackgroundElements();
|
||||
|
||||
/// <summary>
|
||||
/// Called when background elements require updates, usually due to a user changing a setting.
|
||||
/// </summary>
|
||||
/// <param name="userChange"></param>
|
||||
protected virtual void UpdateBackgroundElements()
|
||||
{
|
||||
if (!this.IsCurrentScreen()) return;
|
||||
|
||||
Background?.BlurTo(new Vector2((float)BlurLevel.Value * 25), BACKGROUND_FADE_DURATION, Easing.OutQuint);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -24,6 +24,8 @@ namespace osu.Game.Screens.Ranking
|
||||
{
|
||||
public abstract class Results : OsuScreen
|
||||
{
|
||||
protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
|
||||
|
||||
private Container circleOuterBackground;
|
||||
private Container circleOuter;
|
||||
private Container circleInner;
|
||||
@ -38,8 +40,6 @@ namespace osu.Game.Screens.Ranking
|
||||
|
||||
private Container currentPage;
|
||||
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
|
||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||
|
||||
private const float overscan = 1.3f;
|
||||
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Ranking
|
||||
public override void OnEntering(IScreen last)
|
||||
{
|
||||
base.OnEntering(last);
|
||||
(Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint);
|
||||
(Background as BackgroundScreenBeatmap)?.BlurTo(BACKGROUND_BLUR, 2500, Easing.OutQuint);
|
||||
Background.ScaleTo(1.1f, transition_time, Easing.OutQuint);
|
||||
|
||||
allCircles.ForEach(c =>
|
||||
|
@ -37,8 +37,8 @@ namespace osu.Game.Screens.Select
|
||||
{
|
||||
public abstract class SongSelect : OsuScreen
|
||||
{
|
||||
protected static readonly Vector2 BACKGROUND_BLUR = new Vector2(20);
|
||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||
private static readonly Vector2 background_blur = new Vector2(20);
|
||||
private const float left_area_padding = 20;
|
||||
|
||||
public readonly FilterControl FilterControl;
|
||||
@ -556,7 +556,7 @@ namespace osu.Game.Screens.Select
|
||||
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
||||
{
|
||||
backgroundModeBeatmap.Beatmap = beatmap;
|
||||
backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint);
|
||||
backgroundModeBeatmap.BlurTo(BACKGROUND_BLUR, 750, Easing.OutQuint);
|
||||
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user