private void RunCustomImporterType(Type type)
        {
            // Instantiate a custom importer class for specialized projects to use
            CustomTmxImporter customImporter;

            try
            {
                customImporter = Activator.CreateInstance(type) as CustomTmxImporter;
            }
            catch (Exception e)
            {
                ReportError("Error creating custom importer class. Message = '{0}'", e.Message);
                return;
            }

            try
            {
                var args = new TmxAssetImportedArgs();
                args.AssetImporter    = this;
                args.ImportedSuperMap = m_MapComponent;

                customImporter.TmxAssetImported(args);
            }
            catch (Exception e)
            {
                ReportError("Custom importer '{0}' threw an exception. Message = '{1}', Stack:\n{2}", customImporter.GetType().Name, e.Message, e.StackTrace);
            }
        }
示例#2
0
        private void DoCustomImporting()
        {
            if (!string.IsNullOrEmpty(m_CustomImporterClassName))
            {
                var type = Type.GetType(m_CustomImporterClassName);

                if (type == null)
                {
                    ReportError("Custom Importer error. Class type '{0}' is missing.", m_CustomImporterClassName);
                    return;
                }

                // Instantiate a custom importer class for specialized projects to use
                CustomTmxImporter customImporter;
                try
                {
                    customImporter = Activator.CreateInstance(type) as CustomTmxImporter;
                }
                catch (Exception e)
                {
                    ReportError("Error creating custom importer class. Message = '{0}'", e.Message);
                    return;
                }

                try
                {
                    var args = new TmxAssetImportedArgs();
                    args.AssetImporter    = this;
                    args.ImportedSuperMap = m_MapComponent;

                    customImporter.TmxAssetImported(args);
                }
                catch (Exception e)
                {
                    ReportError("Customm importer '{0}' through an exception. Message = '{0}'", e.Message);
                }
            }
        }
 // Invoked when a Tmx asset import is completed (the prefab and all other objects associated with the asset have been constructed)
 public abstract void TmxAssetImported(TmxAssetImportedArgs args);