public static TgxTemplate FromXml(XElement xml, uint firstId, TmxMap map) { TgxTemplate tgxTemplate = new TgxTemplate(map); tgxTemplate.Name = TmxHelper.GetAttributeAsString(xml, "name"); tgxTemplate.LocalId = TmxHelper.GetAttributeAsUInt(xml, "id"); tgxTemplate.GlobalId = firstId + tgxTemplate.LocalId; tgxTemplate.ObjectXml = xml.Element("object"); return(tgxTemplate); }
public void ParseTemplateGroupXml(XElement xml) { Name = TmxHelper.GetAttributeAsString(xml, "name"); NextTemplateId = TmxHelper.GetAttributeAsUInt(xml, "nexttemplateid"); TemplateMap = ParentMap.MakeTemplate(Name); foreach (XElement item in xml.Descendants("tileset")) { TsxTileset.FromXml(item, TemplateMap); } foreach (XElement item2 in xml.Descendants("template")) { TgxTemplate tgxTemplate = TgxTemplate.FromXml(item2, FirstTemplateId, TemplateMap); if (tgxTemplate != null) { Templates.Add(tgxTemplate); } } }