mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 10:02:59 +08:00
Fix background dim not being disabled on playerloader exit
This commit is contained in:
parent
0a265c6d35
commit
df148f8787
@ -40,6 +40,7 @@ namespace osu.Game.Tests.Visual
|
|||||||
private class DimAccessiblePlayer : Player
|
private class DimAccessiblePlayer : Player
|
||||||
{
|
{
|
||||||
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground();
|
protected override BackgroundScreen CreateBackground() => new FadeAccessibleBackground();
|
||||||
|
|
||||||
public void EnableScreenDim()
|
public void EnableScreenDim()
|
||||||
{
|
{
|
||||||
Background.UpdateDim.Value = true;
|
Background.UpdateDim.Value = true;
|
||||||
|
@ -11,6 +11,7 @@ using osu.Game.Beatmaps;
|
|||||||
using osu.Game.Configuration;
|
using osu.Game.Configuration;
|
||||||
using osu.Game.Graphics;
|
using osu.Game.Graphics;
|
||||||
using osu.Game.Graphics.Backgrounds;
|
using osu.Game.Graphics.Backgrounds;
|
||||||
|
using osuTK.Graphics;
|
||||||
|
|
||||||
namespace osu.Game.Screens.Backgrounds
|
namespace osu.Game.Screens.Backgrounds
|
||||||
{
|
{
|
||||||
@ -20,7 +21,6 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
protected Bindable<double> DimLevel;
|
protected Bindable<double> DimLevel;
|
||||||
public Bindable<bool> UpdateDim;
|
public Bindable<bool> UpdateDim;
|
||||||
|
|
||||||
protected float BackgroundOpacity => 1 - (float)DimLevel;
|
|
||||||
protected Container FadeContainer;
|
protected Container FadeContainer;
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
[BackgroundDependencyLoader]
|
||||||
@ -76,16 +76,15 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
|
|
||||||
public override bool OnExiting(IScreen last)
|
public override bool OnExiting(IScreen last)
|
||||||
{
|
{
|
||||||
UpdateDim.Value = false;
|
|
||||||
return base.OnExiting(last);
|
return base.OnExiting(last);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateBackgroundDim()
|
private void updateBackgroundDim()
|
||||||
{
|
{
|
||||||
if (UpdateDim)
|
if (UpdateDim)
|
||||||
FadeContainer?.FadeColour(OsuColour.Gray(BackgroundOpacity), 800, Easing.OutQuint);
|
FadeContainer?.FadeColour(OsuColour.Gray(1 - (float)DimLevel), 800, Easing.OutQuint);
|
||||||
else
|
else
|
||||||
FadeContainer?.FadeColour(OsuColour.Gray(1.0f), 800, Easing.OutQuint);
|
FadeContainer?.FadeColour(Color4.White, 800, Easing.OutQuint);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
public BackgroundScreenBeatmap(WorkingBeatmap beatmap = null)
|
||||||
@ -94,11 +93,6 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
UpdateDim = new Bindable<bool>();
|
UpdateDim = new Bindable<bool>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void EnableUserDim()
|
|
||||||
{
|
|
||||||
UpdateDim.Value = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public override bool Equals(BackgroundScreen other)
|
public override bool Equals(BackgroundScreen other)
|
||||||
{
|
{
|
||||||
var otherBeatmapBackground = other as BackgroundScreenBeatmap;
|
var otherBeatmapBackground = other as BackgroundScreenBeatmap;
|
||||||
|
@ -248,7 +248,7 @@ namespace osu.Game.Screens.Play
|
|||||||
foreach (var mod in Beatmap.Value.Mods.Value.OfType<IApplicableToScoreProcessor>())
|
foreach (var mod in Beatmap.Value.Mods.Value.OfType<IApplicableToScoreProcessor>())
|
||||||
mod.ApplyToScoreProcessor(ScoreProcessor);
|
mod.ApplyToScoreProcessor(ScoreProcessor);
|
||||||
|
|
||||||
Background?.EnableUserDim();
|
Background.UpdateDim.Value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void applyRateFromMods()
|
private void applyRateFromMods()
|
||||||
@ -298,7 +298,7 @@ namespace osu.Game.Screens.Play
|
|||||||
if (RulesetContainer.ReplayScore == null)
|
if (RulesetContainer.ReplayScore == null)
|
||||||
scoreManager.Import(score, true);
|
scoreManager.Import(score, true);
|
||||||
|
|
||||||
this.Push(CreateResults(score));
|
this.Push(CreateResults(score));
|
||||||
|
|
||||||
onCompletionEvent = null;
|
onCompletionEvent = null;
|
||||||
});
|
});
|
||||||
@ -389,15 +389,16 @@ namespace osu.Game.Screens.Play
|
|||||||
{
|
{
|
||||||
// In the case of replays, we may have changed the playback rate.
|
// In the case of replays, we may have changed the playback rate.
|
||||||
applyRateFromMods();
|
applyRateFromMods();
|
||||||
|
Background.UpdateDim.Value = false;
|
||||||
fadeOut();
|
fadeOut();
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (LoadedBeatmapSuccessfully)
|
if (LoadedBeatmapSuccessfully)
|
||||||
|
{
|
||||||
pauseContainer?.Pause();
|
pauseContainer?.Pause();
|
||||||
|
return true;
|
||||||
Background.UpdateDim.Value = false;
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -242,6 +242,7 @@ namespace osu.Game.Screens.Play
|
|||||||
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
content.ScaleTo(0.7f, 150, Easing.InQuint);
|
||||||
this.FadeOut(150);
|
this.FadeOut(150);
|
||||||
cancelLoad();
|
cancelLoad();
|
||||||
|
Background.UpdateDim.Value = false;
|
||||||
|
|
||||||
return base.OnExiting(next);
|
return base.OnExiting(next);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user