private Attachment ReadAttachment(Skin skin, String name, Dictionary <String, Object> map)
{
if (map.ContainsKey("name"))
{
name = (String)map["name"];
}
AttachmentType type = AttachmentType.region;
if (map.ContainsKey("type"))
{
type = (AttachmentType)Enum.Parse(typeof(AttachmentType), (String)map["type"], false);
}
Attachment attachment = attachmentLoader.NewAttachment(skin, type, name);
if (attachment is RegionAttachment)
{
RegionAttachment regionAttachment = (RegionAttachment)attachment;
regionAttachment.X = GetFloat(map, "x", 0) * Scale;
regionAttachment.Y = GetFloat(map, "y", 0) * Scale;
regionAttachment.ScaleX = GetFloat(map, "scaleX", 1);
regionAttachment.ScaleY = GetFloat(map, "scaleY", 1);
regionAttachment.Rotation = GetFloat(map, "rotation", 0);
regionAttachment.Width = GetFloat(map, "width", 32) * Scale;
regionAttachment.Height = GetFloat(map, "height", 32) * Scale;
regionAttachment.UpdateOffset();
}
return(attachment);
}