mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:42:55 +08:00
Merge remote-tracking branch 'upstream/master' into pause-logic-simplification
This commit is contained in:
commit
15f9a6b9df
@ -48,8 +48,8 @@ namespace osu.Game.Tests.Visual
|
|||||||
};
|
};
|
||||||
|
|
||||||
private DummySongSelect songSelect;
|
private DummySongSelect songSelect;
|
||||||
private DimAccessiblePlayerLoader playerLoader;
|
private TestPlayerLoader playerLoader;
|
||||||
private DimAccessiblePlayer player;
|
private TestPlayer player;
|
||||||
private DatabaseContextFactory factory;
|
private DatabaseContextFactory factory;
|
||||||
private BeatmapManager manager;
|
private BeatmapManager manager;
|
||||||
private RulesetStore rulesets;
|
private RulesetStore rulesets;
|
||||||
@ -74,30 +74,26 @@ namespace osu.Game.Tests.Visual
|
|||||||
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, Beatmap.Default));
|
Dependencies.Cache(manager = new BeatmapManager(LocalStorage, factory, rulesets, null, null, host, Beatmap.Default));
|
||||||
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
Dependencies.Cache(new OsuConfigManager(LocalStorage));
|
||||||
|
|
||||||
|
manager.Import(TestResources.GetTestBeatmapForImport());
|
||||||
|
|
||||||
Beatmap.SetDefault();
|
Beatmap.SetDefault();
|
||||||
}
|
}
|
||||||
|
|
||||||
[SetUp]
|
[SetUp]
|
||||||
public virtual void SetUp()
|
public virtual void SetUp() => Schedule(() =>
|
||||||
{
|
{
|
||||||
Schedule(() =>
|
Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both };
|
||||||
{
|
screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect());
|
||||||
manager.Delete(manager.GetAllUsableBeatmapSets());
|
});
|
||||||
var temp = TestResources.GetTestBeatmapForImport();
|
|
||||||
manager.Import(temp);
|
|
||||||
Child = screenStackContainer = new ScreenStackCacheContainer { RelativeSizeAxes = Axes.Both };
|
|
||||||
screenStackContainer.ScreenStack.Push(songSelect = new DummySongSelect());
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void PlayerLoaderSettingsHoverTest()
|
public void PlayerLoaderSettingsHoverTest()
|
||||||
{
|
{
|
||||||
setupUserSettings();
|
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("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
AddUntilStep("Wait for Player Loader to load", () => playerLoader?.IsLoaded ?? false);
|
||||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
||||||
AddStep("Trigger background preview", () =>
|
AddStep("Trigger background preview", () =>
|
||||||
@ -106,16 +102,16 @@ namespace osu.Game.Tests.Visual
|
|||||||
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
InputManager.MoveMouseTo(playerLoader.VisualSettingsPos);
|
||||||
});
|
});
|
||||||
waitForDim();
|
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));
|
AddStep("Stop background preview", () => InputManager.MoveMouseTo(playerLoader.ScreenPos));
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && playerLoader.IsBlurCorrect());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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:
|
/// 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.
|
/// 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 is still properly applied after entering player.
|
/// We need to check that in this scenario, the dim and blur is still properly applied after entering player.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void PlayerLoaderTransitionTest()
|
public void PlayerLoaderTransitionTest()
|
||||||
@ -124,7 +120,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
AddStep("Trigger hover event", () => playerLoader.TriggerOnHover());
|
AddStep("Trigger hover event", () => playerLoader.TriggerOnHover());
|
||||||
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
AddAssert("Background retained from song select", () => songSelect.IsBackgroundCurrent());
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is dimmed and unblurred", () => songSelect.IsBackgroundDimmed() && songSelect.IsBackgroundUnblurred());
|
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -165,24 +161,24 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the <see cref="UserDimContainer"/> is properly accepting user dim changes at all.
|
/// Check if the <see cref="UserDimContainer"/> is properly accepting user-defined visual changes at all.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void DisableUserDimTest()
|
public void DisableUserDimTest()
|
||||||
{
|
{
|
||||||
performFullSetup();
|
performFullSetup();
|
||||||
waitForDim();
|
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);
|
AddStep("EnableUserDim disabled", () => songSelect.DimEnabled.Value = false);
|
||||||
waitForDim();
|
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);
|
AddStep("EnableUserDim enabled", () => songSelect.DimEnabled.Value = true);
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Check if the fade container retains dim when pausing
|
/// Check if the visual settings container retains dim and blur when pausing
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void PauseTest()
|
public void PauseTest()
|
||||||
@ -190,26 +186,29 @@ namespace osu.Game.Tests.Visual
|
|||||||
performFullSetup(true);
|
performFullSetup(true);
|
||||||
AddStep("Pause", () => player.Pause());
|
AddStep("Pause", () => player.Pause());
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
AddStep("Unpause", () => player.Resume());
|
AddStep("Unpause", () => player.Resume());
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is dimmed", () => songSelect.IsBackgroundDimmed());
|
AddAssert("Screen is dimmed and blur applied", () => songSelect.IsBackgroundDimmed() && songSelect.IsUserBlurApplied());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TransitionTest()
|
public void TransitionTest()
|
||||||
{
|
{
|
||||||
performFullSetup();
|
performFullSetup();
|
||||||
AddStep("Transition to Results", () => player.Push(new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } })));
|
var results = new FadeAccessibleResults(new ScoreInfo { User = new User { Username = "osu!" } });
|
||||||
|
AddStep("Transition to Results", () => player.Push(results));
|
||||||
|
AddUntilStep("Wait for results is current", results.IsCurrentScreen);
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is undimmed and is original background", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent());
|
AddAssert("Screen is undimmed, original background retained", () =>
|
||||||
|
songSelect.IsBackgroundUndimmed() && songSelect.IsBackgroundCurrent() && results.IsBlurCorrect());
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <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>
|
/// </summary>
|
||||||
[Test]
|
[Test]
|
||||||
public void TransitionOutTest()
|
public void TransitionOutTest()
|
||||||
@ -217,7 +216,23 @@ namespace osu.Game.Tests.Visual
|
|||||||
performFullSetup();
|
performFullSetup();
|
||||||
AddStep("Exit to song select", () => player.Exit());
|
AddStep("Exit to song select", () => player.Exit());
|
||||||
waitForDim();
|
waitForDim();
|
||||||
AddAssert("Screen is undimmed", () => songSelect.IsBackgroundUndimmed());
|
AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && songSelect.IsBlurCorrect());
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Check if hovering on the visual settings dialogue after resuming from player still previews the background dim.
|
||||||
|
/// </summary>
|
||||||
|
[Test]
|
||||||
|
public void ResumeFromPlayerTest()
|
||||||
|
{
|
||||||
|
performFullSetup();
|
||||||
|
AddStep("Move mouse to Visual Settings", () => InputManager.MoveMouseTo(playerLoader.VisualSettingsPos));
|
||||||
|
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));
|
||||||
|
waitForDim();
|
||||||
|
AddAssert("Screen is undimmed and user blur removed", () => songSelect.IsBackgroundUndimmed() && playerLoader.IsBlurCorrect());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void waitForDim() => AddWaitStep("Wait for dim", 5);
|
private void waitForDim() => AddWaitStep("Wait for dim", 5);
|
||||||
@ -243,7 +258,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
AddStep("Start player loader", () =>
|
AddStep("Start player loader", () =>
|
||||||
{
|
{
|
||||||
songSelect.Push(playerLoader = new DimAccessiblePlayerLoader(player = new DimAccessiblePlayer
|
songSelect.Push(playerLoader = new TestPlayerLoader(player = new TestPlayer
|
||||||
{
|
{
|
||||||
AllowPause = allowPause,
|
AllowPause = allowPause,
|
||||||
Ready = true,
|
Ready = true,
|
||||||
@ -261,7 +276,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
{
|
{
|
||||||
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() });
|
Beatmap.Value.Mods.Value = Beatmap.Value.Mods.Value.Concat(new[] { new OsuModNoFail() });
|
||||||
songSelect.DimLevel.Value = 0.7f;
|
songSelect.DimLevel.Value = 0.7f;
|
||||||
songSelect.BlurLevel.Value = 0.0f;
|
songSelect.BlurLevel.Value = 0.4f;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -289,14 +304,18 @@ namespace osu.Game.Tests.Visual
|
|||||||
|
|
||||||
public bool IsBackgroundDimmed() => ((FadeAccessibleBackground)Background).CurrentColour == OsuColour.Gray(1 - (float)DimLevel.Value);
|
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 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 IsBackgroundInvisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 0;
|
||||||
|
|
||||||
public bool IsBackgroundVisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 1;
|
public bool IsBackgroundVisible() => ((FadeAccessibleBackground)Background).CurrentAlpha == 1;
|
||||||
|
|
||||||
|
public bool IsBlurCorrect() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(BACKGROUND_BLUR);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Make sure every time a screen gets pushed, the background doesn't get replaced
|
/// Make sure every time a screen gets pushed, the background doesn't get replaced
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -312,9 +331,11 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
||||||
|
|
||||||
|
public bool IsBlurCorrect() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(BACKGROUND_BLUR);
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DimAccessiblePlayer : Player
|
private class TestPlayer : Player
|
||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
||||||
|
|
||||||
@ -366,18 +387,20 @@ namespace osu.Game.Tests.Visual
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class DimAccessiblePlayerLoader : PlayerLoader
|
private class TestPlayerLoader : PlayerLoader
|
||||||
{
|
{
|
||||||
public VisualSettings VisualSettingsPos => VisualSettings;
|
public VisualSettings VisualSettingsPos => VisualSettings;
|
||||||
public BackgroundScreen ScreenPos => Background;
|
public BackgroundScreen ScreenPos => Background;
|
||||||
|
|
||||||
public DimAccessiblePlayerLoader(Player player)
|
public TestPlayerLoader(Player player)
|
||||||
: base(() => player)
|
: base(() => player)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public void TriggerOnHover() => OnHover(new HoverEvent(new InputState()));
|
public void TriggerOnHover() => OnHover(new HoverEvent(new InputState()));
|
||||||
|
|
||||||
|
public bool IsBlurCorrect() => ((FadeAccessibleBackground)Background).CurrentBlur == new Vector2(BACKGROUND_BLUR);
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground(Beatmap.Value);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -386,6 +409,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
protected override UserDimContainer CreateFadeContainer() => fadeContainer = new TestUserDimContainer { RelativeSizeAxes = Axes.Both };
|
protected override UserDimContainer CreateFadeContainer() => fadeContainer = new TestUserDimContainer { RelativeSizeAxes = Axes.Both };
|
||||||
|
|
||||||
public Color4 CurrentColour => fadeContainer.CurrentColour;
|
public Color4 CurrentColour => fadeContainer.CurrentColour;
|
||||||
|
|
||||||
public float CurrentAlpha => fadeContainer.CurrentAlpha;
|
public float CurrentAlpha => fadeContainer.CurrentAlpha;
|
||||||
|
|
||||||
public Vector2 CurrentBlur => Background.BlurSigma;
|
public Vector2 CurrentBlur => Background.BlurSigma;
|
||||||
|
@ -1,27 +1,26 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
|
using System;
|
||||||
using osu.Framework.Allocation;
|
using osu.Framework.Allocation;
|
||||||
using osu.Framework.Bindables;
|
using osu.Framework.Bindables;
|
||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
|
using osu.Game.Graphics.Backgrounds;
|
||||||
|
using osuTK;
|
||||||
using osuTK.Graphics;
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Graphics.Containers
|
namespace osu.Game.Graphics.Containers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <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.
|
/// This container specifies behavior that applies to both Storyboards and Backgrounds.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class UserDimContainer : Container
|
public class UserDimContainer : Container
|
||||||
{
|
{
|
||||||
private const float background_fade_duration = 800;
|
private const float background_fade_duration = 800;
|
||||||
|
|
||||||
private Bindable<double> dimLevel { get; set; }
|
|
||||||
|
|
||||||
private Bindable<bool> showStoryboard { get; set; }
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Whether or not user-configured dim levels should be applied to the container.
|
/// Whether or not user-configured dim levels should be applied to the container.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -32,19 +31,40 @@ namespace osu.Game.Graphics.Containers
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of blur to be applied to the background in addition to user-specified blur.
|
||||||
|
/// </summary>
|
||||||
|
/// <remarks>
|
||||||
|
/// Used in contexts where there can potentially be both user and screen-specified blurring occuring at the same time, such as in <see cref="PlayerLoader"/>
|
||||||
|
/// </remarks>
|
||||||
|
public readonly Bindable<float> BlurAmount = new Bindable<float>();
|
||||||
|
|
||||||
|
private Bindable<double> userDimLevel { get; set; }
|
||||||
|
|
||||||
|
private Bindable<double> userBlurLevel { get; set; }
|
||||||
|
|
||||||
|
private Bindable<bool> showStoryboard { get; set; }
|
||||||
|
|
||||||
protected Container DimContainer { get; }
|
protected Container DimContainer { get; }
|
||||||
|
|
||||||
protected override Container<Drawable> Content => DimContainer;
|
protected override Container<Drawable> Content => DimContainer;
|
||||||
|
|
||||||
private readonly bool isStoryboard;
|
private readonly bool isStoryboard;
|
||||||
|
|
||||||
|
/// <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
|
||||||
|
? new Vector2(BlurAmount.Value + (float)userBlurLevel.Value * 25)
|
||||||
|
: new Vector2(BlurAmount.Value);
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Creates a new <see cref="UserDimContainer"/>.
|
/// Creates a new <see cref="UserDimContainer"/>.
|
||||||
/// </summary>
|
/// </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>
|
/// <remarks>
|
||||||
/// While both backgrounds and storyboards allow user dim levels to be applied, storyboards can be toggled via <see cref="showStoryboard"/>
|
/// 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>
|
/// </remarks>
|
||||||
/// </param>
|
/// </param>
|
||||||
public UserDimContainer(bool isStoryboard = false)
|
public UserDimContainer(bool isStoryboard = false)
|
||||||
@ -53,36 +73,62 @@ namespace osu.Game.Graphics.Containers
|
|||||||
AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both });
|
AddInternal(DimContainer = new Container { RelativeSizeAxes = Axes.Both });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private Background background;
|
||||||
|
|
||||||
|
public Background Background
|
||||||
|
{
|
||||||
|
get => background;
|
||||||
|
set
|
||||||
|
{
|
||||||
|
base.Add(background = value);
|
||||||
|
background.BlurTo(blurTarget, 0, Easing.OutQuint);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public override void Add(Drawable drawable)
|
||||||
|
{
|
||||||
|
if (drawable is Background)
|
||||||
|
throw new InvalidOperationException($"Use {nameof(Background)} to set a background.");
|
||||||
|
|
||||||
|
base.Add(drawable);
|
||||||
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
private void load(OsuConfigManager config)
|
private void load(OsuConfigManager config)
|
||||||
{
|
{
|
||||||
dimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
userDimLevel = config.GetBindable<double>(OsuSetting.DimLevel);
|
||||||
|
userBlurLevel = config.GetBindable<double>(OsuSetting.BlurLevel);
|
||||||
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
EnableUserDim.ValueChanged += _ => updateBackgroundDim();
|
|
||||||
dimLevel.ValueChanged += _ => updateBackgroundDim();
|
EnableUserDim.ValueChanged += _ => updateVisuals();
|
||||||
showStoryboard.ValueChanged += _ => updateBackgroundDim();
|
userDimLevel.ValueChanged += _ => updateVisuals();
|
||||||
StoryboardReplacesBackground.ValueChanged += _ => updateBackgroundDim();
|
userBlurLevel.ValueChanged += _ => updateVisuals();
|
||||||
|
showStoryboard.ValueChanged += _ => updateVisuals();
|
||||||
|
StoryboardReplacesBackground.ValueChanged += _ => updateVisuals();
|
||||||
|
BlurAmount.ValueChanged += _ => updateVisuals();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void LoadComplete()
|
protected override void LoadComplete()
|
||||||
{
|
{
|
||||||
base.LoadComplete();
|
base.LoadComplete();
|
||||||
updateBackgroundDim();
|
updateVisuals();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBackgroundDim()
|
private void updateVisuals()
|
||||||
{
|
{
|
||||||
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
|
||||||
{
|
{
|
||||||
// The background needs to be hidden in the case of it being replaced by the storyboard
|
// 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);
|
DimContainer.FadeTo(showStoryboard.Value && StoryboardReplacesBackground.Value ? 0 : 1, 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);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -37,6 +37,8 @@ namespace osu.Game.Rulesets.Difficulty
|
|||||||
/// <returns>A structure describing the difficulty of the beatmap.</returns>
|
/// <returns>A structure describing the difficulty of the beatmap.</returns>
|
||||||
public DifficultyAttributes Calculate(params Mod[] mods)
|
public DifficultyAttributes Calculate(params Mod[] mods)
|
||||||
{
|
{
|
||||||
|
mods = mods.Select(m => m.CreateCopy()).ToArray();
|
||||||
|
|
||||||
beatmap.Mods.Value = mods;
|
beatmap.Mods.Value = mods;
|
||||||
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
IBeatmap playableBeatmap = beatmap.GetPlayableBeatmap(ruleset.RulesetInfo);
|
||||||
|
|
||||||
|
@ -65,5 +65,10 @@ namespace osu.Game.Rulesets.Mods
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
[JsonIgnore]
|
[JsonIgnore]
|
||||||
public virtual Type[] IncompatibleMods => new Type[] { };
|
public virtual Type[] IncompatibleMods => new Type[] { };
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Creates a copy of this <see cref="Mod"/> initialised to a default state.
|
||||||
|
/// </summary>
|
||||||
|
public virtual Mod CreateCopy() => (Mod)Activator.CreateInstance(GetType());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -8,12 +8,14 @@ namespace osu.Game.Rulesets.Objects.Legacy.Catch
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
|
/// Legacy osu!catch Spinner-type, used for parsing Beatmaps.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasCombo
|
internal sealed class ConvertSpinner : HitObject, IHasEndTime, IHasXPosition, IHasCombo
|
||||||
{
|
{
|
||||||
public double EndTime { get; set; }
|
public double EndTime { get; set; }
|
||||||
|
|
||||||
public double Duration => EndTime - StartTime;
|
public double Duration => EndTime - StartTime;
|
||||||
|
|
||||||
|
public float X => 256; // Required for CatchBeatmapConverter
|
||||||
|
|
||||||
public bool NewCombo { get; set; }
|
public bool NewCombo { get; set; }
|
||||||
|
|
||||||
public int ComboOffset { get; set; }
|
public int ComboOffset { get; set; }
|
||||||
|
@ -12,8 +12,10 @@ using osu.Game.Graphics.Containers;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Backgrounds
|
namespace osu.Game.Screens.Backgrounds
|
||||||
{
|
{
|
||||||
public class BackgroundScreenBeatmap : BlurrableBackgroundScreen
|
public class BackgroundScreenBeatmap : BackgroundScreen
|
||||||
{
|
{
|
||||||
|
protected Background Background;
|
||||||
|
|
||||||
private WorkingBeatmap beatmap;
|
private WorkingBeatmap beatmap;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -23,6 +25,11 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
public readonly Bindable<bool> StoryboardReplacesBackground = new Bindable<bool>();
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The amount of blur to be applied in addition to user-specified blur.
|
||||||
|
/// </summary>
|
||||||
|
public readonly Bindable<float> BlurAmount = new Bindable<float>();
|
||||||
|
|
||||||
private readonly UserDimContainer fadeContainer;
|
private readonly UserDimContainer fadeContainer;
|
||||||
|
|
||||||
protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both };
|
protected virtual UserDimContainer CreateFadeContainer() => new UserDimContainer { RelativeSizeAxes = Axes.Both };
|
||||||
@ -32,6 +39,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
Beatmap = beatmap;
|
Beatmap = beatmap;
|
||||||
InternalChild = fadeContainer = CreateFadeContainer();
|
InternalChild = fadeContainer = CreateFadeContainer();
|
||||||
fadeContainer.EnableUserDim.BindTo(EnableUserDim);
|
fadeContainer.EnableUserDim.BindTo(EnableUserDim);
|
||||||
|
fadeContainer.BlurAmount.BindTo(BlurAmount);
|
||||||
}
|
}
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -77,8 +85,7 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
}
|
}
|
||||||
|
|
||||||
b.Depth = newDepth;
|
b.Depth = newDepth;
|
||||||
fadeContainer.Add(Background = b);
|
fadeContainer.Background = Background = b;
|
||||||
Background.BlurSigma = BlurTarget;
|
|
||||||
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
|
StoryboardReplacesBackground.BindTo(fadeContainer.StoryboardReplacesBackground);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,8 +13,10 @@ using osu.Game.Users;
|
|||||||
|
|
||||||
namespace osu.Game.Screens.Backgrounds
|
namespace osu.Game.Screens.Backgrounds
|
||||||
{
|
{
|
||||||
public class BackgroundScreenDefault : BlurrableBackgroundScreen
|
public class BackgroundScreenDefault : BackgroundScreen
|
||||||
{
|
{
|
||||||
|
private Background background;
|
||||||
|
|
||||||
private int currentDisplay;
|
private int currentDisplay;
|
||||||
private const int background_count = 5;
|
private const int background_count = 5;
|
||||||
|
|
||||||
@ -39,10 +41,10 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
private void display(Background newBackground)
|
private void display(Background newBackground)
|
||||||
{
|
{
|
||||||
Background?.FadeOut(800, Easing.InOutSine);
|
background?.FadeOut(800, Easing.InOutSine);
|
||||||
Background?.Expire();
|
background?.Expire();
|
||||||
|
|
||||||
AddInternal(Background = newBackground);
|
AddInternal(background = newBackground);
|
||||||
currentDisplay++;
|
currentDisplay++;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -56,16 +58,16 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
private Background createBackground()
|
private Background createBackground()
|
||||||
{
|
{
|
||||||
Background background;
|
Background newBackground;
|
||||||
|
|
||||||
if (user.Value?.IsSupporter ?? false)
|
if (user.Value?.IsSupporter ?? false)
|
||||||
background = new SkinnedBackground(skin.Value, backgroundName);
|
newBackground = new SkinnedBackground(skin.Value, backgroundName);
|
||||||
else
|
else
|
||||||
background = new Background(backgroundName);
|
newBackground = new Background(backgroundName);
|
||||||
|
|
||||||
background.Depth = currentDisplay;
|
newBackground.Depth = currentDisplay;
|
||||||
|
|
||||||
return background;
|
return newBackground;
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SkinnedBackground : Background
|
private class SkinnedBackground : Background
|
||||||
|
@ -1,23 +0,0 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
|
||||||
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Graphics.Transforms;
|
|
||||||
using osu.Game.Graphics.Backgrounds;
|
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens
|
|
||||||
{
|
|
||||||
public abstract class BlurrableBackgroundScreen : BackgroundScreen
|
|
||||||
{
|
|
||||||
protected Background Background;
|
|
||||||
|
|
||||||
protected Vector2 BlurTarget;
|
|
||||||
|
|
||||||
public TransformSequence<Background> BlurTo(Vector2 sigma, double duration = 0, Easing easing = Easing.None)
|
|
||||||
{
|
|
||||||
BlurTarget = sigma;
|
|
||||||
return Background?.BlurTo(BlurTarget, duration, easing);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -77,7 +77,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (StoryboardContainer == null || storyboard != null)
|
if (StoryboardContainer == null || storyboard != null)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
if (!ShowStoryboard.Value)
|
if (!showStoryboard.Value)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var beatmap = Beatmap.Value;
|
var beatmap = Beatmap.Value;
|
||||||
@ -93,6 +93,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
|
||||||
|
private Bindable<bool> showStoryboard;
|
||||||
|
|
||||||
protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true)
|
protected virtual UserDimContainer CreateStoryboardContainer() => new UserDimContainer(true)
|
||||||
{
|
{
|
||||||
RelativeSizeAxes = Axes.Both,
|
RelativeSizeAxes = Axes.Both,
|
||||||
@ -117,6 +119,7 @@ namespace osu.Game.Screens.Play
|
|||||||
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
sampleRestart = audio.Sample.Get(@"Gameplay/restart");
|
||||||
|
|
||||||
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
mouseWheelDisabled = config.GetBindable<bool>(OsuSetting.MouseDisableWheel);
|
||||||
|
showStoryboard = config.GetBindable<bool>(OsuSetting.ShowStoryboard);
|
||||||
|
|
||||||
ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
|
ScoreProcessor = DrawableRuleset.CreateScoreProcessor();
|
||||||
if (!ScoreProcessor.Mode.Disabled)
|
if (!ScoreProcessor.Mode.Disabled)
|
||||||
@ -422,9 +425,10 @@ namespace osu.Game.Screens.Play
|
|||||||
.Delay(250)
|
.Delay(250)
|
||||||
.FadeIn(250);
|
.FadeIn(250);
|
||||||
|
|
||||||
ShowStoryboard.ValueChanged += _ => initializeStoryboard(true);
|
showStoryboard.ValueChanged += _ => initializeStoryboard(true);
|
||||||
|
|
||||||
Background.EnableUserDim.Value = true;
|
Background.EnableUserDim.Value = true;
|
||||||
|
Background.BlurAmount.Value = 0;
|
||||||
|
|
||||||
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
Background.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||||
StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
StoryboardContainer.StoryboardReplacesBackground.BindTo(storyboardReplacesBackground);
|
||||||
|
@ -8,7 +8,7 @@ using osu.Framework.Allocation;
|
|||||||
using osu.Framework.Graphics;
|
using osu.Framework.Graphics;
|
||||||
using osu.Framework.Graphics.Containers;
|
using osu.Framework.Graphics.Containers;
|
||||||
using osu.Framework.Graphics.Sprites;
|
using osu.Framework.Graphics.Sprites;
|
||||||
using osu.Framework.Input.Events;
|
using osu.Framework.Input;
|
||||||
using osu.Framework.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
@ -26,8 +26,9 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
public class PlayerLoader : ScreenWithBeatmapBackground
|
public class PlayerLoader : ScreenWithBeatmapBackground
|
||||||
{
|
{
|
||||||
|
protected const float BACKGROUND_BLUR = 15;
|
||||||
|
|
||||||
private readonly Func<Player> createPlayer;
|
private readonly Func<Player> createPlayer;
|
||||||
private static readonly Vector2 background_blur = new Vector2(15);
|
|
||||||
|
|
||||||
private Player player;
|
private Player player;
|
||||||
|
|
||||||
@ -42,6 +43,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
|
|
||||||
|
private InputManager inputManager;
|
||||||
|
|
||||||
public PlayerLoader(Func<Player> createPlayer)
|
public PlayerLoader(Func<Player> createPlayer)
|
||||||
{
|
{
|
||||||
this.createPlayer = createPlayer;
|
this.createPlayer = createPlayer;
|
||||||
@ -133,6 +136,7 @@ namespace osu.Game.Screens.Play
|
|||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
|
|
||||||
content.ScaleTo(0.7f);
|
content.ScaleTo(0.7f);
|
||||||
|
Background?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||||
|
|
||||||
contentIn();
|
contentIn();
|
||||||
|
|
||||||
@ -151,43 +155,20 @@ namespace osu.Game.Screens.Play
|
|||||||
logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo);
|
logo.Delay(resuming ? 0 : 500).MoveToOffset(new Vector2(0, -0.24f), 500, Easing.InOutExpo);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void LoadComplete()
|
||||||
|
{
|
||||||
|
inputManager = GetContainingInputManager();
|
||||||
|
base.LoadComplete();
|
||||||
|
}
|
||||||
|
|
||||||
private ScheduledDelegate pushDebounce;
|
private ScheduledDelegate pushDebounce;
|
||||||
protected VisualSettings VisualSettings;
|
protected VisualSettings VisualSettings;
|
||||||
|
|
||||||
|
// Hhere because IsHovered will not update unless we do so.
|
||||||
|
public override bool HandlePositionalInput => true;
|
||||||
|
|
||||||
private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null;
|
private bool readyForPush => player.LoadState == LoadState.Ready && IsHovered && GetContainingInputManager()?.DraggedDrawable == null;
|
||||||
|
|
||||||
protected override bool OnHover(HoverEvent e)
|
|
||||||
{
|
|
||||||
// restore our screen defaults
|
|
||||||
if (this.IsCurrentScreen())
|
|
||||||
{
|
|
||||||
InitializeBackgroundElements();
|
|
||||||
Background.EnableUserDim.Value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnHover(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
|
||||||
{
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
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()
|
private void pushWhenLoaded()
|
||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
@ -266,6 +247,29 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
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))
|
||||||
|
{
|
||||||
|
// Preview user-defined background dim and blur when hovered on the visual settings panel.
|
||||||
|
Background.EnableUserDim.Value = true;
|
||||||
|
Background.BlurAmount.Value = 0;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Returns background dim and blur to the values specified by PlayerLoader.
|
||||||
|
Background.EnableUserDim.Value = false;
|
||||||
|
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class BeatmapMetadataDisplay : Container
|
private class BeatmapMetadataDisplay : Container
|
||||||
{
|
{
|
||||||
private class MetadataLine : Container
|
private class MetadataLine : Container
|
||||||
|
@ -1,13 +1,7 @@
|
|||||||
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
||||||
// See the LICENCE file in the repository root for full licence text.
|
// See the LICENCE file in the repository root for full licence text.
|
||||||
|
|
||||||
using osu.Framework.Allocation;
|
|
||||||
using osu.Framework.Bindables;
|
|
||||||
using osu.Framework.Graphics;
|
|
||||||
using osu.Framework.Screens;
|
|
||||||
using osu.Game.Configuration;
|
|
||||||
using osu.Game.Screens.Backgrounds;
|
using osu.Game.Screens.Backgrounds;
|
||||||
using osuTK;
|
|
||||||
|
|
||||||
namespace osu.Game.Screens.Play
|
namespace osu.Game.Screens.Play
|
||||||
{
|
{
|
||||||
@ -16,50 +10,5 @@ namespace osu.Game.Screens.Play
|
|||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
protected new BackgroundScreenBeatmap Background => (BackgroundScreenBeatmap)base.Background;
|
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 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
|
public abstract class Results : OsuScreen
|
||||||
{
|
{
|
||||||
|
protected const float BACKGROUND_BLUR = 20;
|
||||||
|
|
||||||
private Container circleOuterBackground;
|
private Container circleOuterBackground;
|
||||||
private Container circleOuter;
|
private Container circleOuter;
|
||||||
private Container circleInner;
|
private Container circleInner;
|
||||||
@ -38,8 +40,6 @@ namespace osu.Game.Screens.Ranking
|
|||||||
|
|
||||||
private Container currentPage;
|
private Container currentPage;
|
||||||
|
|
||||||
private static readonly Vector2 background_blur = new Vector2(20);
|
|
||||||
|
|
||||||
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
protected override BackgroundScreen CreateBackground() => new BackgroundScreenBeatmap(Beatmap.Value);
|
||||||
|
|
||||||
private const float overscan = 1.3f;
|
private const float overscan = 1.3f;
|
||||||
@ -58,7 +58,7 @@ namespace osu.Game.Screens.Ranking
|
|||||||
public override void OnEntering(IScreen last)
|
public override void OnEntering(IScreen last)
|
||||||
{
|
{
|
||||||
base.OnEntering(last);
|
base.OnEntering(last);
|
||||||
(Background as BackgroundScreenBeatmap)?.BlurTo(background_blur, 2500, Easing.OutQuint);
|
((BackgroundScreenBeatmap)Background).BlurAmount.Value = BACKGROUND_BLUR;
|
||||||
Background.ScaleTo(1.1f, transition_time, Easing.OutQuint);
|
Background.ScaleTo(1.1f, transition_time, Easing.OutQuint);
|
||||||
|
|
||||||
allCircles.ForEach(c =>
|
allCircles.ForEach(c =>
|
||||||
|
@ -38,7 +38,7 @@ namespace osu.Game.Screens.Select
|
|||||||
public abstract class SongSelect : OsuScreen
|
public abstract class SongSelect : OsuScreen
|
||||||
{
|
{
|
||||||
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
private static readonly Vector2 wedged_container_size = new Vector2(0.5f, 245);
|
||||||
private static readonly Vector2 background_blur = new Vector2(20);
|
protected const float BACKGROUND_BLUR = 20;
|
||||||
private const float left_area_padding = 20;
|
private const float left_area_padding = 20;
|
||||||
|
|
||||||
public readonly FilterControl FilterControl;
|
public readonly FilterControl FilterControl;
|
||||||
@ -64,7 +64,6 @@ namespace osu.Game.Screens.Select
|
|||||||
protected override BackgroundScreen CreateBackground()
|
protected override BackgroundScreen CreateBackground()
|
||||||
{
|
{
|
||||||
var background = new BackgroundScreenBeatmap();
|
var background = new BackgroundScreenBeatmap();
|
||||||
background.BlurTo(background_blur);
|
|
||||||
return background;
|
return background;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -561,7 +560,7 @@ namespace osu.Game.Screens.Select
|
|||||||
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
if (Background is BackgroundScreenBeatmap backgroundModeBeatmap)
|
||||||
{
|
{
|
||||||
backgroundModeBeatmap.Beatmap = beatmap;
|
backgroundModeBeatmap.Beatmap = beatmap;
|
||||||
backgroundModeBeatmap.BlurTo(background_blur, 750, Easing.OutQuint);
|
backgroundModeBeatmap.BlurAmount.Value = BACKGROUND_BLUR;
|
||||||
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
backgroundModeBeatmap.FadeColour(Color4.White, 250);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -16,7 +16,7 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.319.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.320.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
@ -105,8 +105,8 @@
|
|||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite.Core" Version="2.2.1" />
|
||||||
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
<PackageReference Include="Newtonsoft.Json" Version="12.0.1" />
|
||||||
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
<PackageReference Include="ppy.osu.Game.Resources" Version="2019.128.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework" Version="2019.319.0" />
|
<PackageReference Include="ppy.osu.Framework" Version="2019.320.0" />
|
||||||
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.319.0" />
|
<PackageReference Include="ppy.osu.Framework.iOS" Version="2019.320.0" />
|
||||||
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
<PackageReference Include="SharpCompress" Version="0.22.0" />
|
||||||
<PackageReference Include="NUnit" Version="3.11.0" />
|
<PackageReference Include="NUnit" Version="3.11.0" />
|
||||||
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
<PackageReference Include="SharpRaven" Version="2.4.0" />
|
||||||
|
Loading…
Reference in New Issue
Block a user