summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Tiled/ContentReaderExtensions.cs
blob: 86f1b6be9e57f78ec921de80d0b7b348acd59ffe (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
using Microsoft.Xna.Framework.Content;

namespace MonoGame.Extended.Tiled
{
    public static class ContentReaderExtensions
    {
        public static void ReadTiledMapProperties(this ContentReader reader, TiledMapProperties properties)
        {
            var count = reader.ReadInt32();

            for (var i = 0; i < count; i++)
            {
                var key = reader.ReadString();
                var value = new TiledMapPropertyValue(reader.ReadString());
                ReadTiledMapProperties(reader, value.Properties);
                properties[key] = value;
            }
        }
    }
}