summaryrefslogtreecommitdiff
path: root/Plugins/MonoGame.Extended/source/MonoGame.Extended.Tiled/Serialization/TiledMapLayerContent.cs
blob: 01d8a9d565d3e3be4739956b70f3774c99d47b91 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
using System.Collections.Generic;
using System.Xml.Serialization;

namespace MonoGame.Extended.Tiled.Serialization
{
    [XmlInclude(typeof(TiledMapTileLayerContent))]
    [XmlInclude(typeof(TiledMapImageLayerContent))]
    [XmlInclude(typeof(TiledMapObjectLayerContent))]
    public abstract class TiledMapLayerContent
    {
        protected TiledMapLayerContent(TiledMapLayerType layerType)
        {
            LayerType = layerType;
            Opacity = 1.0f;
            ParallaxX = 1.0f;
            ParallaxY = 1.0f;
            Visible = true;
            Properties = new List<TiledMapPropertyContent>();
        }

        [XmlAttribute(AttributeName = "name")]
        public string Name { get; set; }

        // Deprecated as of Tiled 1.9.0 (replaced by "class" attribute)
        [XmlAttribute(DataType = "string", AttributeName = "type")]
        public string Type { get; set; }

        [XmlAttribute(DataType = "string", AttributeName = "class")]
        public string Class { get; set; }

        [XmlAttribute(AttributeName = "opacity")]
        public float Opacity { get; set; }

        [XmlAttribute(AttributeName = "visible")]
        public bool Visible { get; set; }

        [XmlAttribute(AttributeName = "offsetx")]
        public float OffsetX { get; set; }

        [XmlAttribute(AttributeName = "offsety")]
        public float OffsetY { get; set; }

        [XmlAttribute(AttributeName = "parallaxx")]
        public float ParallaxX { get; set; }

        [XmlAttribute(AttributeName = "parallaxy")]
        public float ParallaxY { get; set; }

        [XmlArray("properties")]
        [XmlArrayItem("property")]
        public List<TiledMapPropertyContent> Properties { get; set; }

        [XmlIgnore]
        public TiledMapLayerType LayerType { get; }

        public override string ToString()
        {
            return Name;
        }
    }
}