// Load an Object Type Xml file for this map's objects to reference public void LoadObjectTypeXml(string xmlPath) { if (String.IsNullOrEmpty(xmlPath)) { Logger.WriteInfo("Object Type XML file is not being used."); return; } Logger.WriteInfo("Loading Object Type Xml file: '{0}'", xmlPath); try { this.ObjectTypes = TmxObjectTypes.FromXmlFile(xmlPath); } catch (FileNotFoundException) { Logger.WriteError("Object Type Xml file was not found: {0}", xmlPath); this.ObjectTypes = new TmxObjectTypes(); } catch (Exception e) { Logger.WriteError("Error parsing Object Type Xml file: {0}\n{1}", xmlPath, e.Message); Logger.WriteError("Stack:\n{0}", e.StackTrace); this.ObjectTypes = new TmxObjectTypes(); } Logger.WriteInfo("Tiled Object Type count = {0}", this.ObjectTypes.TmxObjectTypeMapping.Count()); }
// Load an Object Type Xml file for this map's objects to reference public void LoadObjectTypeXml(string xmlPath) { if (String.IsNullOrEmpty(xmlPath)) { Program.WriteLine("No Object Type Xml file loaded."); this.ObjectTypes = new TmxObjectTypes(); } else { Program.WriteLine("Loading Object Type Xml file: '{0}'", xmlPath); try { this.ObjectTypes = TmxObjectTypes.FromXmlFile(xmlPath); } catch (FileNotFoundException) { Program.WriteError("Object Type Xml file was not found: {0}", xmlPath); } catch (Exception e) { Program.WriteError("Error parsing Object Type Xml file: {0}\n{1}", xmlPath, e.Message); } } Program.WriteLine("Tiled Object Type count = {0}", this.ObjectTypes.TmxObjectTypeMapping.Count()); }
// Load an Object Type Xml file for this map's objects to reference public void LoadObjectTypeXml(string xmlPath) { Logger.WriteLine("Loading Object Type Xml file: '{0}'", xmlPath); try { this.ObjectTypes = TmxObjectTypes.FromXmlFile(xmlPath); } catch (FileNotFoundException) { Logger.WriteError("Object Type Xml file was not found: {0}", xmlPath); this.ObjectTypes = new TmxObjectTypes(); } catch (Exception e) { Logger.WriteError("Error parsing Object Type Xml file: {0}\n{1}", xmlPath, e.Message); this.ObjectTypes = new TmxObjectTypes(); } Logger.WriteLine("Tiled Object Type count = {0}", this.ObjectTypes.TmxObjectTypeMapping.Count()); }