mirror of https://github.com/ppy/osu
Simplify logic
This commit is contained in:
parent
2518d16a77
commit
fcb197f7b6
|
@ -4,6 +4,7 @@
|
|||
using osu.Framework.Allocation;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Framework.Graphics.Transforms;
|
||||
using OpenTK;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics.Backgrounds;
|
||||
|
@ -19,10 +20,7 @@ public class BackgroundScreenBeatmap : BackgroundScreen
|
|||
|
||||
public WorkingBeatmap Beatmap
|
||||
{
|
||||
get
|
||||
{
|
||||
return beatmap;
|
||||
}
|
||||
get { return beatmap; }
|
||||
set
|
||||
{
|
||||
if (beatmap == value && beatmap != null)
|
||||
|
@ -56,11 +54,8 @@ public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
|||
Beatmap = beatmap;
|
||||
}
|
||||
|
||||
public void BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None)
|
||||
{
|
||||
background?.BlurTo(sigma, duration, easing);
|
||||
blurTarget = sigma;
|
||||
}
|
||||
public TransformSequence<Background> BlurTo(Vector2 sigma, double duration, Easing easing = Easing.None)
|
||||
=> background?.BlurTo(blurTarget = sigma, duration, easing);
|
||||
|
||||
public override bool Equals(BackgroundScreen other)
|
||||
{
|
||||
|
|
|
@ -24,10 +24,10 @@
|
|||
using osu.Game.Screens.Ranking;
|
||||
using osu.Framework.Audio.Sample;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Screens.Play.BreaksOverlay;
|
||||
using osu.Game.Storyboards.Drawables;
|
||||
using OpenTK.Graphics;
|
||||
|
||||
namespace osu.Game.Screens.Play
|
||||
{
|
||||
|
@ -378,8 +378,9 @@ protected override bool OnExiting(Screen next)
|
|||
|
||||
private void updateBackgroundElements()
|
||||
{
|
||||
const float duration = 800;
|
||||
|
||||
var opacity = 1 - (float)dimLevel;
|
||||
var blur = new Vector2((float)blurLevel.Value * 25);
|
||||
|
||||
if (showStoryboard && storyboard == null)
|
||||
initializeStoryboard(true);
|
||||
|
@ -387,11 +388,13 @@ private void updateBackgroundElements()
|
|||
var beatmap = Beatmap.Value;
|
||||
var storyboardVisible = showStoryboard && beatmap.Storyboard.HasDrawable;
|
||||
|
||||
storyboardContainer.FadeColour(new Color4(opacity, opacity, opacity, 1), 800);
|
||||
storyboardContainer.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, 800, Easing.OutQuint);
|
||||
storyboardContainer
|
||||
.FadeColour(OsuColour.Gray(opacity), duration, Easing.OutQuint)
|
||||
.FadeTo(storyboardVisible && opacity > 0 ? 1 : 0, duration, Easing.OutQuint);
|
||||
|
||||
Background?.FadeTo(!storyboardVisible || beatmap.Background == null ? opacity : 0, 800, Easing.OutQuint);
|
||||
(Background as BackgroundScreenBeatmap)?.BlurTo(blur, 800, Easing.OutQuint);
|
||||
(Background as BackgroundScreenBeatmap)?
|
||||
.BlurTo(new Vector2((float)blurLevel.Value * 25), duration, Easing.OutQuint)?
|
||||
.FadeTo(!storyboardVisible || beatmap.Background == null ? opacity : 0, duration, Easing.OutQuint);
|
||||
}
|
||||
|
||||
private void fadeOut()
|
||||
|
|
Loading…
Reference in New Issue