osu/osu.Game/Graphics/Backgrounds/SkinBackground.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

37 lines
1021 B
C#
Raw Normal View History

2021-06-08 19:57:08 +00: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.
2022-06-17 07:37:17 +00:00
#nullable disable
2021-06-08 19:57:08 +00:00
using osu.Framework.Allocation;
using osu.Game.Skinning;
namespace osu.Game.Graphics.Backgrounds
{
internal class SkinBackground : Background
{
private readonly Skin skin;
public SkinBackground(Skin skin, string fallbackTextureName)
: base(fallbackTextureName)
{
this.skin = skin;
}
[BackgroundDependencyLoader]
private void load()
{
Sprite.Texture = skin.GetTexture("menu-background") ?? Sprite.Texture;
}
public override bool Equals(Background other)
{
if (ReferenceEquals(null, other)) return false;
if (ReferenceEquals(this, other)) return true;
return other.GetType() == GetType()
&& ((SkinBackground)other).skin.SkinInfo.Equals(skin.SkinInfo);
}
2021-06-08 19:57:08 +00:00
}
}