attribute individual fields, not the class

This commit is contained in:
Bob
2010-08-27 19:13:42 +12:00
committed by Chris Forbes
parent 29a77f7c5c
commit 9fedeefdbc
6 changed files with 52 additions and 71 deletions

View File

@@ -29,13 +29,12 @@ namespace OpenRA.FileFormats
public MiniYaml Save() { return FieldSaver.Save(this); }
}
[FieldLoader.Foo("Id", "Image", "Size", "PickAny")]
public class TileTemplate
{
public ushort Id;
public string Image;
public int2 Size;
public bool PickAny;
[FieldLoader.Load] public ushort Id;
[FieldLoader.Load] public string Image;
[FieldLoader.Load] public int2 Size;
[FieldLoader.Load] public bool PickAny;
[FieldLoader.LoadUsing( "LoadTiles" )]
public Dictionary<byte, string> Tiles = new Dictionary<byte, string>();
@@ -84,7 +83,7 @@ namespace OpenRA.FileFormats
public TileSet() {}
public TileSet( string filepath )
{
var yaml = MiniYaml.FromFile(filepath).ToDictionary( x => x.Key, x => x.Value );
var yaml = MiniYaml.DictFromFile( filepath );
// General info
FieldLoader.Load(this, yaml["General"]);