This repository was archived by the owner on Oct 31, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathObject.cs
More file actions
101 lines (89 loc) · 1.63 KB
/
Object.cs
File metadata and controls
101 lines (89 loc) · 1.63 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
namespace Xevle.FileFormats.TMX
{
public class Object
{
public List<Property> Properties { get; private set; }
public string Name { get; private set; }
public string Type { get; private set; }
public int X { get; set; }
public int Y { get; set; }
public int Width { get; set; }
public int Height { get; set; }
public Object(string name, string type, int width, int height, int x, int y)
{
Properties = new List<Property>();
Name = name;
Type = type;
Width = width;
Height = height;
X = x;
Y = y;
}
public Object(XmlNode node)
{
Properties = new List<Property>();
foreach (XmlAttribute i in node.Attributes)
{
switch (i.Name.ToLower())
{
case "name":
{
Name = i.Value.ToString();
break;
}
case "type":
{
Type = i.Value.ToString();
break;
}
case "x":
{
X = Convert.ToInt32(i.Value);
break;
}
case "y":
{
Y = Convert.ToInt32(i.Value);
break;
}
case "width":
{
Width = Convert.ToInt32(i.Value);
break;
}
case "height":
{
Height = Convert.ToInt32(i.Value);
break;
}
default:
{
break;
}
}
}
foreach (XmlNode i in node.ChildNodes)
{
switch (i.Name.ToLower())
{
case "properties":
{
foreach (XmlNode j in i.ChildNodes)
{
Properties.Add(new Property(j));
}
break;
}
default:
{
break;
}
}
}
}
}
}