void ReadAtlas(XmlElement element)
{
SpriterAtlas atlas = new SpriterAtlas();
m_Data.atlases.Add(atlas);
int folderID = 0;
string folderName = string.Empty;
foreach(XmlAttribute attribute in element.Attributes)
{
// id
if (attribute.Name.Equals("id"))
atlas.ID = int.Parse(attribute.Value);
// data_path
else if (attribute.Name.Equals("data_path"))
atlas.dataPath = attribute.Value;
// image_path
else if (attribute.Name.Equals("image_path"))
atlas.imagePath = attribute.Value;
}
foreach(XmlElement child in element)
{
if (child.Name.Equals("folder"))
{
foreach(XmlAttribute attribute in child.Attributes)
{
// folder id
if (attribute.Name.Equals("id"))
folderID = int.Parse(attribute.Value);
// folder name
else if (attribute.Name.Equals("name"))
folderName = attribute.Value;
}
foreach(XmlElement child2 in child)
{
SpriterAtlasImage image = new SpriterAtlasImage();
atlas.images.Add(image);
foreach(XmlAttribute attribute in child2.Attributes)
{
// image id
if (attribute.Name.Equals("id"))
image.ID = int.Parse(attribute.Value);
// image full_path
else if (attribute.Name.Equals("full_path"))
image.fullPath = attribute.Value;
}
// other properties
image.folderID = folderID;
image.folderName = folderName;
}
}
}
}