mirror of
https://github.com/ppy/osu.git
synced 2024-11-13 19:27:31 +08:00
Move skin background to separate file
This commit is contained in:
parent
04cc788627
commit
5bf4dd6358
25
osu.Game/Graphics/Backgrounds/SkinBackground.cs
Normal file
25
osu.Game/Graphics/Backgrounds/SkinBackground.cs
Normal file
@ -0,0 +1,25 @@
|
|||||||
|
// 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.
|
||||||
|
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -140,22 +140,5 @@ namespace osu.Game.Screens.Backgrounds
|
|||||||
return $@"Menu/menu-background-{currentDisplay % background_count + 1}";
|
return $@"Menu/menu-background-{currentDisplay % background_count + 1}";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class SkinnedBackground : Background
|
|
||||||
{
|
|
||||||
private readonly Skin skin;
|
|
||||||
|
|
||||||
public SkinnedBackground(Skin skin, string fallbackTextureName)
|
|
||||||
: base(fallbackTextureName)
|
|
||||||
{
|
|
||||||
this.skin = skin;
|
|
||||||
}
|
|
||||||
|
|
||||||
[BackgroundDependencyLoader]
|
|
||||||
private void load()
|
|
||||||
{
|
|
||||||
Sprite.Texture = skin.GetTexture("menu-background") ?? Sprite.Texture;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user