1
0
mirror of https://github.com/ppy/osu.git synced 2024-10-01 15:17:31 +08:00
osu-lazer/osu.Game/Skinning/BeatmapSkin.cs

32 lines
1.1 KiB
C#
Raw Normal View History

2018-03-14 19:45:04 +08:00
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System.IO;
2018-03-15 23:14:29 +08:00
using osu.Framework.Audio;
2018-03-14 19:45:04 +08:00
using osu.Framework.Graphics.Textures;
using osu.Framework.IO.Stores;
using osu.Game.Beatmaps;
namespace osu.Game.Skinning
{
public class BeatmapSkin : LegacySkin
{
2018-03-15 23:14:29 +08:00
public BeatmapSkin(BeatmapInfo beatmap, IResourceStore<byte[]> storage, AudioManager audioManager)
2018-03-14 19:45:04 +08:00
: base(new SkinInfo { Name = beatmap.ToString(), Creator = beatmap.Metadata.Author.ToString() })
{
storage = new LegacySkinResourceStore<BeatmapSetFileInfo>(beatmap.BeatmapSet, storage);
2018-03-15 23:14:29 +08:00
Samples = audioManager.GetSampleManager(storage);
2018-03-14 19:45:04 +08:00
Textures = new TextureStore(new RawTextureLoaderStore(storage));
var decoder = new LegacySkinDecoder();
using (StreamReader reader = new StreamReader(storage.GetStream(beatmap.Path)))
{
Configuration = decoder.Decode(reader);
}
}
}
}