2019-09-24 17:42:06 +08:00
|
|
|
|
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
|
|
|
|
|
// See the LICENCE file in the repository root for full licence text.
|
|
|
|
|
|
2023-06-24 21:40:06 +08:00
|
|
|
|
#nullable disable
|
|
|
|
|
|
2019-09-24 17:42:06 +08:00
|
|
|
|
using osu.Framework.Allocation;
|
|
|
|
|
using osu.Framework.Graphics.Textures;
|
|
|
|
|
using osu.Game.Beatmaps;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Graphics.Backgrounds
|
|
|
|
|
{
|
|
|
|
|
public partial class BeatmapBackground : Background
|
|
|
|
|
{
|
|
|
|
|
public readonly WorkingBeatmap Beatmap;
|
|
|
|
|
|
|
|
|
|
private readonly string fallbackTextureName;
|
|
|
|
|
|
|
|
|
|
public BeatmapBackground(WorkingBeatmap beatmap, string fallbackTextureName = @"Backgrounds/bg1")
|
|
|
|
|
{
|
|
|
|
|
Beatmap = beatmap;
|
|
|
|
|
this.fallbackTextureName = fallbackTextureName;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-08-14 17:05:05 +08:00
|
|
|
|
private void load(LargeTextureStore textures)
|
2019-09-24 17:42:06 +08:00
|
|
|
|
{
|
2023-06-24 21:40:06 +08:00
|
|
|
|
Sprite.Texture = Beatmap?.GetBackground() ?? textures.Get(fallbackTextureName);
|
2019-09-24 17:42:06 +08:00
|
|
|
|
}
|
2021-06-09 04:26:15 +08:00
|
|
|
|
|
|
|
|
|
public override bool Equals(Background other)
|
|
|
|
|
{
|
|
|
|
|
if (ReferenceEquals(null, other)) return false;
|
|
|
|
|
if (ReferenceEquals(this, other)) return true;
|
|
|
|
|
|
|
|
|
|
return other.GetType() == GetType()
|
|
|
|
|
&& ((BeatmapBackground)other).Beatmap == Beatmap;
|
|
|
|
|
}
|
2019-09-24 17:42:06 +08:00
|
|
|
|
}
|
2019-11-22 01:39:54 +08:00
|
|
|
|
}
|