1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-15 00:52:57 +08:00

Fix background dim not being disabled on playerloader exit

This commit is contained in:
David Zhao 2019-02-18 12:55:42 +09:00
parent 0a265c6d35
commit df148f8787
4 changed files with 11 additions and 14 deletions

View File

@ -40,6 +40,7 @@ namespace osu.Game.Tests.Visual
private class DimAccessiblePlayer : Player
{
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground();
public void EnableScreenDim()
{
Background.UpdateDim.Value = true;

View File

@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
using osu.Game.Configuration;
using osu.Game.Graphics;
using osu.Game.Graphics.Backgrounds;
using osuTK.Graphics;
namespace osu.Game.Screens.Backgrounds
{
@ -20,7 +21,6 @@ namespace osu.Game.Screens.Backgrounds
protected Bindable<double> DimLevel;
public Bindable<bool> UpdateDim;
protected float BackgroundOpacity => 1 - (float)DimLevel;
protected Container FadeContainer;
[BackgroundDependencyLoader]
@ -76,16 +76,15 @@ namespace osu.Game.Screens.Backgrounds
public override bool OnExiting(IScreen last)
{
UpdateDim.Value = false;
return base.OnExiting(last);
}
private void updateBackgroundDim()
{
if (UpdateDim)
FadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint);
FadeContainer?.FadeColour(OsuColour.Gray(1 - (float)DimLevel), 800, Easing.OutQuint);
else
FadeContainer?.FadeColour(OsuColour.Gray(1.0f), 800, Easing.OutQuint);
FadeContainer?.FadeColour(Color4.White, 800, Easing.OutQuint);
}
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
@ -94,11 +93,6 @@ namespace osu.Game.Screens.Backgrounds
UpdateDim = new Bindable<bool>();
}
public void EnableUserDim()
{
UpdateDim.Value = true;
}
public override bool Equals(BackgroundScreen other)
{
var otherBeatmapBackground = other as BackgroundScreenBeatmap;

View File

@ -248,7 +248,7 @@ namespace osu.Game.Screens.Play
foreach (var mod in Beatmap.Value.Mods.Value.OfType<IApplicableToScoreProcessor>())
mod.ApplyToScoreProcessor(ScoreProcessor);
Background?.EnableUserDim();
Background.UpdateDim.Value = true;
}
private void applyRateFromMods()
@ -298,7 +298,7 @@ namespace osu.Game.Screens.Play
if (RulesetContainer.ReplayScore == null)
scoreManager.Import(score, true);
this.Push(CreateResults(score));
this.Push(CreateResults(score));
onCompletionEvent = null;
});
@ -389,15 +389,16 @@ namespace osu.Game.Screens.Play
{
// In the case of replays, we may have changed the playback rate.
applyRateFromMods();
Background.UpdateDim.Value = false;
fadeOut();
return base.OnExiting(next);
}
if (LoadedBeatmapSuccessfully)
{
pauseContainer?.Pause();
Background.UpdateDim.Value = false;
return true;
}
return true;
}

View File

@ -242,6 +242,7 @@ namespace osu.Game.Screens.Play
content.ScaleTo(0.7f, 150, Easing.InQuint);
this.FadeOut(150);
cancelLoad();
Background.UpdateDim.Value = false;
return base.OnExiting(next);
}