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:
parent
8e52d91180
commit
397b06283a
@ -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)
|
||||
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
Loading…
Reference in New Issue
Block a user