mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
introduce main menu background modes
This commit is contained in:
28
osu.Game/Graphics/Backgrounds/BeatmapBackground.cs
Normal file
28
osu.Game/Graphics/Backgrounds/BeatmapBackground.cs
Normal file
@ -0,0 +1,28 @@
|
||||
// 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.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps;
|
||||
|
||||
namespace osu.Game.Graphics.Backgrounds
|
||||
{
|
||||
public 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]
|
||||
private void load(TextureStore textures)
|
||||
{
|
||||
Sprite.Texture = Beatmap?.Background ?? textures.Get(fallbackTextureName);
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user