mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Add beatmap backgrounds.
This commit is contained in:
@ -4,6 +4,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using osu.Framework.Audio.Track;
|
||||
using osu.Framework.Graphics.Textures;
|
||||
using osu.Game.Beatmaps.Formats;
|
||||
using osu.Game.Beatmaps.IO;
|
||||
using osu.Game.Database;
|
||||
@ -19,6 +20,24 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
private ArchiveReader reader => database.GetReader(BeatmapSetInfo);
|
||||
|
||||
private Texture background;
|
||||
public Texture Background
|
||||
{
|
||||
get
|
||||
{
|
||||
if (background != null) return background;
|
||||
|
||||
try
|
||||
{
|
||||
background = new TextureStore(new RawTextureLoaderStore(reader)).Get(BeatmapInfo.Metadata.BackgroundFile);
|
||||
}
|
||||
catch { }
|
||||
|
||||
return background;
|
||||
}
|
||||
set { background = value; }
|
||||
}
|
||||
|
||||
private Beatmap beatmap;
|
||||
public Beatmap Beatmap
|
||||
{
|
||||
@ -28,7 +47,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
try
|
||||
{
|
||||
using (var stream = new StreamReader(reader.ReadFile(BeatmapInfo.Path)))
|
||||
using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path)))
|
||||
beatmap = BeatmapDecoder.GetDecoder(stream)?.Decode(stream);
|
||||
}
|
||||
catch { }
|
||||
@ -47,7 +66,7 @@ namespace osu.Game.Beatmaps
|
||||
|
||||
try
|
||||
{
|
||||
var trackData = reader.ReadFile(BeatmapInfo.Metadata.AudioFile);
|
||||
var trackData = reader.GetStream(BeatmapInfo.Metadata.AudioFile);
|
||||
if (trackData != null)
|
||||
track = new AudioTrackBass(trackData);
|
||||
}
|
||||
|
Reference in New Issue
Block a user