mirror of
https://github.com/ppy/osu.git
synced 2025-01-28 08:43:20 +08:00
Simplify colour provider caching
This commit is contained in:
parent
8e470678c7
commit
1305634c52
@ -17,11 +17,12 @@ namespace osu.Game.Overlays
|
|||||||
[Resolved]
|
[Resolved]
|
||||||
protected IAPIProvider API { get; private set; }
|
protected IAPIProvider API { get; private set; }
|
||||||
|
|
||||||
private readonly OverlayColourScheme colourScheme;
|
[Cached]
|
||||||
|
private OverlayColourProvider colourProvider;
|
||||||
|
|
||||||
protected FullscreenOverlay(OverlayColourScheme colourScheme)
|
protected FullscreenOverlay(OverlayColourScheme colourScheme)
|
||||||
{
|
{
|
||||||
this.colourScheme = colourScheme;
|
colourProvider = new OverlayColourProvider(colourScheme);
|
||||||
|
|
||||||
RelativeSizeAxes = Axes.Both;
|
RelativeSizeAxes = Axes.Both;
|
||||||
RelativePositionAxes = 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]
|
[BackgroundDependencyLoader]
|
||||||
private void load()
|
private void load()
|
||||||
{
|
{
|
||||||
OverlayColourProvider colourProvider;
|
|
||||||
dependencies.Cache(colourProvider = new OverlayColourProvider(colourScheme));
|
|
||||||
|
|
||||||
Waves.FirstWaveColour = colourProvider.Highlight1;
|
Waves.FirstWaveColour = colourProvider.Highlight1;
|
||||||
Waves.SecondWaveColour = colourProvider.Light4;
|
Waves.SecondWaveColour = colourProvider.Light4;
|
||||||
Waves.ThirdWaveColour = colourProvider.Dark3;
|
Waves.ThirdWaveColour = colourProvider.Dark3;
|
||||||
|
Loading…
Reference in New Issue
Block a user