From d9846fad37d4d2b9453621c2b225b9a3cf12cc8c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Max=20H=C3=BCbner?= Date: Thu, 29 Oct 2020 18:03:36 +0100 Subject: [PATCH] Remove fallback texture parameter When there isn't a seasonal event, we don't want to fall back to the basic background here, but rather to the user selected background source. --- .../Backgrounds/SeasonalBackgroundLoader.cs | 21 +++++++------------ 1 file changed, 8 insertions(+), 13 deletions(-) diff --git a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs index 72785be3b4..abd9664106 100644 --- a/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs +++ b/osu.Game/Graphics/Backgrounds/SeasonalBackgroundLoader.cs @@ -3,7 +3,6 @@ using System.Collections.Generic; using System.Linq; -using JetBrains.Annotations; using osu.Framework.Allocation; using osu.Framework.Bindables; using osu.Framework.Graphics; @@ -38,17 +37,14 @@ namespace osu.Game.Graphics.Backgrounds api.PerformAsync(request); } - public SeasonalBackground LoadBackground(string fallbackTextureName) + public SeasonalBackground LoadBackground() { - string url = null; + if (!backgrounds.Value.Any()) return null; - if (backgrounds.Value.Any()) - { - current = (current + 1) % backgrounds.Value.Count; - url = backgrounds.Value[current].Url; - } + current = (current + 1) % backgrounds.Value.Count; + string url = backgrounds.Value[current].Url; - return new SeasonalBackground(url, fallbackTextureName); + return new SeasonalBackground(url); } } @@ -56,18 +52,17 @@ namespace osu.Game.Graphics.Backgrounds public class SeasonalBackground : Background { private readonly string url; - private readonly string fallbackTextureName; + private const string fallback_texture_name = @"Backgrounds/bg1"; - public SeasonalBackground([CanBeNull] string url, string fallbackTextureName = @"Backgrounds/bg1") + public SeasonalBackground(string url) { this.url = url; - this.fallbackTextureName = fallbackTextureName; } [BackgroundDependencyLoader] private void load(LargeTextureStore textures) { - Sprite.Texture = textures.Get(url) ?? textures.Get(fallbackTextureName); + Sprite.Texture = textures.Get(url) ?? textures.Get(fallback_texture_name); } } }