1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-14 02:22:56 +08:00

Simplify colour provider caching

This commit is contained in:
Andrei Zavatski 2020-01-26 14:02:05 +03:00
parent 8e470678c7
commit 1305634c52

View File

@ -17,11 +17,12 @@ namespace osu.Game.Overlays
[Resolved]
protected IAPIProvider API { get; private set; }
private readonly OverlayColourScheme colourScheme;
[Cached]
private OverlayColourProvider colourProvider;
protected FullscreenOverlay(OverlayColourScheme colourScheme)
{
this.colourScheme = colourScheme;
colourProvider = new OverlayColourProvider(colourScheme);
RelativeSizeAxes = Axes.Both;
RelativePositionAxes = Axes.Both;
@ -39,17 +40,9 @@ namespace osu.Game.Overlays
};
}
private DependencyContainer dependencies;
protected override IReadOnlyDependencyContainer CreateChildDependencies(IReadOnlyDependencyContainer parent) =>
dependencies = new DependencyContainer(base.CreateChildDependencies(parent));
[BackgroundDependencyLoader]
private void load()
{
OverlayColourProvider colourProvider;
dependencies.Cache(colourProvider = new OverlayColourProvider(colourScheme));
Waves.FirstWaveColour = colourProvider.Highlight1;
Waves.SecondWaveColour = colourProvider.Light4;
Waves.ThirdWaveColour = colourProvider.Dark3;