diff --git a/osu.Game/Overlays/Direct/DirectGridPanel.cs b/osu.Game/Overlays/Direct/DirectGridPanel.cs index 243c5f1a4d..c1777038c0 100644 --- a/osu.Game/Overlays/Direct/DirectGridPanel.cs +++ b/osu.Game/Overlays/Direct/DirectGridPanel.cs @@ -58,7 +58,7 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, - GetBackground(textures, false), + CreateBackground(), new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/Direct/DirectListPanel.cs b/osu.Game/Overlays/Direct/DirectListPanel.cs index c2299e8255..f693998563 100644 --- a/osu.Game/Overlays/Direct/DirectListPanel.cs +++ b/osu.Game/Overlays/Direct/DirectListPanel.cs @@ -12,7 +12,6 @@ using osu.Game.Graphics.Sprites; using osu.Game.Database; using osu.Framework.Allocation; using osu.Framework.Localisation; -using osu.Framework.Graphics.Textures; using osu.Framework.Input; using osu.Framework.Graphics.Shapes; using osu.Game.Graphics.Containers; @@ -48,7 +47,7 @@ namespace osu.Game.Overlays.Direct } [BackgroundDependencyLoader] - private void load(LocalisationEngine localisation, TextureStore textures) + private void load(LocalisationEngine localisation) { Children = new[] { @@ -57,7 +56,7 @@ namespace osu.Game.Overlays.Direct RelativeSizeAxes = Axes.Both, Colour = Color4.Black, }, - GetBackground(textures, true), + CreateBackground(), new Box { RelativeSizeAxes = Axes.Both, diff --git a/osu.Game/Overlays/Direct/DirectPanel.cs b/osu.Game/Overlays/Direct/DirectPanel.cs index 1c2ecd767c..02b6e32192 100644 --- a/osu.Game/Overlays/Direct/DirectPanel.cs +++ b/osu.Game/Overlays/Direct/DirectPanel.cs @@ -34,23 +34,25 @@ namespace osu.Game.Overlays.Direct return icons; } - protected Drawable GetBackground(TextureStore textures, bool doubleSize) + protected Drawable CreateBackground() => new DelayedLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo) { - return new DelayedLoadWrapper(new BeatmapSetBackgroundSprite(SetInfo, doubleSize) - { - Anchor = Anchor.Centre, - Origin = Anchor.Centre, - RelativeSizeAxes = Axes.Both, - FillMode = FillMode.Fill, - OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), - }) { RelativeSizeAxes = Axes.Both, TimeBeforeLoad = 300 }; - } + Anchor = Anchor.Centre, + Origin = Anchor.Centre, + RelativeSizeAxes = Axes.Both, + FillMode = FillMode.Fill, + OnLoadComplete = d => d.FadeInFromZero(400, EasingTypes.Out), + }) + { + RelativeSizeAxes = Axes.Both, + TimeBeforeLoad = 300 + }; public class Statistic : FillFlowContainer { private readonly SpriteText text; private int value; + public int Value { get { return value; } @@ -91,19 +93,18 @@ namespace osu.Game.Overlays.Direct private class BeatmapSetBackgroundSprite : Sprite { private readonly BeatmapSetInfo set; - private readonly bool doubleSize; - - public BeatmapSetBackgroundSprite(BeatmapSetInfo set, bool doubleSize) + public BeatmapSetBackgroundSprite(BeatmapSetInfo set) { this.set = set; - this.doubleSize = doubleSize; } [BackgroundDependencyLoader] private void load(TextureStore textures) { - if (set.OnlineInfo?.Covers?.Card != null) - Texture = textures.Get(doubleSize ? set.OnlineInfo.Covers.Card2X : set.OnlineInfo.Covers.Card); + string resource = set.OnlineInfo.Covers.Card; + + if (resource != null) + Texture = textures.Get(resource); } } }