From 39c0d89cdf012c47f296ecd19112d1d9a74d3206 Mon Sep 17 00:00:00 2001 From: Maciej <3stylemylife@gmail.com> Date: Mon, 7 Nov 2016 04:20:17 +0100 Subject: [PATCH] Cleanup --- osu.Game/GameModes/Backgrounds/BackgroundModeCustom.cs | 9 +-------- osu.Game/GameModes/Play/Player.cs | 6 +----- osu.Game/Graphics/Background/Background.cs | 10 +--------- 3 files changed, 3 insertions(+), 22 deletions(-) diff --git a/osu.Game/GameModes/Backgrounds/BackgroundModeCustom.cs b/osu.Game/GameModes/Backgrounds/BackgroundModeCustom.cs index a04f50f139..a603b3904e 100644 --- a/osu.Game/GameModes/Backgrounds/BackgroundModeCustom.cs +++ b/osu.Game/GameModes/Backgrounds/BackgroundModeCustom.cs @@ -2,7 +2,6 @@ //Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE using osu.Framework; -using osu.Framework.Graphics.Textures; using osu.Game.Graphics.Background; namespace osu.Game.GameModes.Backgrounds @@ -10,22 +9,16 @@ namespace osu.Game.GameModes.Backgrounds public class BackgroundModeCustom : BackgroundMode { private readonly string textureName; - private readonly Texture texture; public BackgroundModeCustom(string textureName) { this.textureName = textureName; } - public BackgroundModeCustom(Texture texture) - { - this.texture = texture; - } - protected override void Load(BaseGame game) { base.Load(game); - Add((texture != null) ? new Background(texture) : new Background(textureName)); + Add(new Background(textureName)); } public override bool Equals(BackgroundMode other) diff --git a/osu.Game/GameModes/Play/Player.cs b/osu.Game/GameModes/Play/Player.cs index 46f59c5948..d48e252fa5 100644 --- a/osu.Game/GameModes/Play/Player.cs +++ b/osu.Game/GameModes/Play/Player.cs @@ -20,8 +20,7 @@ namespace osu.Game.GameModes.Play { const bool autoplay = false; - private BackgroundMode background; - protected override BackgroundMode CreateBackground() => background; + protected override BackgroundMode CreateBackground() => new BackgroundModeCustom(@"Backgrounds/bg4"); public BeatmapInfo BeatmapInfo; @@ -50,9 +49,6 @@ namespace osu.Game.GameModes.Play AudioTrack track = Beatmap.Track; - if (Beatmap.Background != null) - background = new BackgroundModeCustom(Beatmap.Background); - if (track != null) { game.Audio.Track.SetExclusive(track); diff --git a/osu.Game/Graphics/Background/Background.cs b/osu.Game/Graphics/Background/Background.cs index 17a95f4eeb..1b36feb761 100644 --- a/osu.Game/Graphics/Background/Background.cs +++ b/osu.Game/Graphics/Background/Background.cs @@ -18,7 +18,6 @@ namespace osu.Game.Graphics.Background { protected Sprite BackgroundSprite; - Texture texture; string textureName; public Background(string textureName = @"Backgrounds/bg1") @@ -28,20 +27,13 @@ namespace osu.Game.Graphics.Background Depth = float.MinValue; } - public Background(Texture texture) - { - this.texture = texture; - RelativeSizeAxes = Axes.Both; - Depth = float.MinValue; - } - protected override void Load(BaseGame game) { base.Load(game); Add(BackgroundSprite = new Sprite { - Texture = texture != null ? texture : game.Textures.Get(textureName), + Texture = game.Textures.Get(textureName), Anchor = Anchor.Centre, Origin = Anchor.Centre, Colour = Color4.DarkGray