mirror of
https://github.com/ppy/osu.git
synced 2024-12-15 06:23:21 +08:00
Move blurring logic into Update instead
This commit is contained in:
parent
1086688e0a
commit
e9034c8a30
@ -2,13 +2,11 @@
|
|||||||
// 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 System;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using osu.Framework.Allocation;
|
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.Localisation;
|
using osu.Framework.Localisation;
|
||||||
using osu.Framework.Screens;
|
using osu.Framework.Screens;
|
||||||
using osu.Framework.Threading;
|
using osu.Framework.Threading;
|
||||||
@ -41,6 +39,8 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
public override bool DisallowExternalBeatmapRulesetChanges => true;
|
||||||
|
|
||||||
|
public override bool HandlePositionalInput => true;
|
||||||
|
|
||||||
private Task loadTask;
|
private Task loadTask;
|
||||||
|
|
||||||
public PlayerLoader(Func<Player> createPlayer)
|
public PlayerLoader(Func<Player> createPlayer)
|
||||||
@ -158,35 +158,6 @@ namespace osu.Game.Screens.Play
|
|||||||
|
|
||||||
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)
|
|
||||||
{
|
|
||||||
// Acts as an "on hover lost" trigger for the visual settings panel.
|
|
||||||
// Returns background dim and blur to the values specified by PlayerLoader.
|
|
||||||
if (this.IsCurrentScreen())
|
|
||||||
{
|
|
||||||
Background.BlurAmount.Value = BACKGROUND_BLUR;
|
|
||||||
Background.EnableUserDim.Value = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return base.OnHover(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnHoverLost(HoverLostEvent e)
|
|
||||||
{
|
|
||||||
// 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.
|
|
||||||
if (GetContainingInputManager()?.HoveredDrawables.Contains(VisualSettings) == true)
|
|
||||||
{
|
|
||||||
if (this.IsCurrentScreen() && Background != null)
|
|
||||||
{
|
|
||||||
Background.BlurAmount.Value = 0;
|
|
||||||
Background.EnableUserDim.Value = true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
base.OnHoverLost(e);
|
|
||||||
}
|
|
||||||
|
|
||||||
private void pushWhenLoaded()
|
private void pushWhenLoaded()
|
||||||
{
|
{
|
||||||
if (!this.IsCurrentScreen()) return;
|
if (!this.IsCurrentScreen()) return;
|
||||||
@ -267,6 +238,29 @@ namespace osu.Game.Screens.Play
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected override void Update()
|
||||||
|
{
|
||||||
|
base.Update();
|
||||||
|
|
||||||
|
if (!this.IsCurrentScreen())
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (Background.BlurAmount.Value != 0 && VisualSettings.IsHovered)
|
||||||
|
{
|
||||||
|
// 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 if (Background.BlurAmount.Value != BACKGROUND_BLUR && !VisualSettings.IsHovered)
|
||||||
|
{
|
||||||
|
// 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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private class BeatmapMetadataDisplay : Container
|
private class BeatmapMetadataDisplay : Container
|
||||||
{
|
{
|
||||||
private class MetadataLine : Container
|
private class MetadataLine : Container
|
||||||
|
Loading…
Reference in New Issue
Block a user