Reduce unnecessary background changes via IEquatable implementation

This commit is contained in:
Bartłomiej Dach
2021-06-08 22:26:15 +02:00
parent f628ec25ef
commit 97204b6f27
4 changed files with 34 additions and 7 deletions

View File

@ -21,5 +21,14 @@ namespace osu.Game.Graphics.Backgrounds
{
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);
}
}
}