Refactor LoadingLayer to avoid applying effects to external drawables

In theory this seemed like a good idea (and an optimisation in some
cases, due to lower fill rate), but in practice this leads to weird edge
cases.

This aims to do away with the operations on external drawables by
applying a dim to the area behind the `LoadingLayer` when required.
I went over each usage and ensured they look as good or better than
previously.

The specific bad usage here was the restoration of the colour on dispose
(if the `LoadingLayer` was disposed in a still-visible state).

I'm aware that the `BeatmapListingOverlay` will now dim completely during
load. I think this is fine for the time being.
This commit is contained in:
Dean Herbert
2021-01-04 22:42:39 +09:00
parent a86a7b08df
commit 54982dcdd7
18 changed files with 389 additions and 389 deletions

View File

@ -1,6 +1,7 @@
// 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 System.Linq;
using NUnit.Framework;
using osu.Framework.Graphics;
using osu.Framework.Graphics.Containers;
@ -14,11 +15,12 @@ namespace osu.Game.Tests.Visual.UserInterface
{
public class TestSceneLoadingLayer : OsuTestScene
{
private Drawable dimContent;
private LoadingLayer overlay;
private Container content;
private Drawable dimContent => overlay.Children.OfType<Box>().First();
[SetUp]
public void SetUp() => Schedule(() =>
{
@ -29,14 +31,14 @@ namespace osu.Game.Tests.Visual.UserInterface
Size = new Vector2(300),
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
Children = new[]
Children = new Drawable[]
{
new Box
{
Colour = Color4.SlateGray,
RelativeSizeAxes = Axes.Both,
},
dimContent = new FillFlowContainer
new FillFlowContainer
{
Anchor = Anchor.Centre,
Origin = Anchor.Centre,
@ -51,7 +53,7 @@ namespace osu.Game.Tests.Visual.UserInterface
new TriangleButton { Text = "puush me", Width = 200, Action = () => { } },
}
},
overlay = new LoadingLayer(dimContent),
overlay = new LoadingLayer(true),
}
},
};