1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-06 06:57:39 +08:00

Add basic skin configuration decoding support

This commit is contained in:
Dean Herbert 2018-03-19 20:05:31 +09:00
parent 8e52d91180
commit 397b06283a
3 changed files with 32 additions and 2 deletions

View File

@ -25,6 +25,11 @@ namespace osu.Game.Skinning
storage = new LegacySkinResourceStore(skin, storage);
samples = audioManager.GetSampleManager(storage);
textures = new TextureStore(new RawTextureLoaderStore(storage));
var decoder = new LegacySkinDecoder();
using (StreamReader reader = new StreamReader(storage.GetStream("skin.ini")))
Configuration = decoder.Decode(reader);
}
public override Drawable GetDrawableComponent(string componentName)

View File

@ -7,9 +7,32 @@ namespace osu.Game.Skinning
{
public class LegacySkinDecoder : LegacyDecoder<SkinConfiguration>
{
public LegacySkinDecoder(int version)
: base(version)
public LegacySkinDecoder()
: base(1)
{
}
protected override void ParseLine(SkinConfiguration output, Section section, string line)
{
switch (section)
{
case Section.General:
var pair = SplitKeyVal(line);
switch (pair.Key)
{
case @"Name":
output.SkinInfo.Name = pair.Value;
break;
case @"Author":
output.SkinInfo.Creator = pair.Value;
break;
}
return;
}
base.ParseLine(output, section, line);
}
}
}

View File

@ -10,6 +10,8 @@ namespace osu.Game.Skinning
{
public readonly SkinInfo SkinInfo;
public virtual SkinConfiguration Configuration { get; protected set; }
public abstract Drawable GetDrawableComponent(string componentName);
public abstract SampleChannel GetSample(string sampleName);