Пример #1
0
 public void ExportTmxMap()
 {
     this.summaryReport.Capture("Exporting");
     {
         if (this.TmxMap.IsLoaded == false)
         {
             Logger.WriteError("Tiled map file not loaded!");
         }
         else
         {
             try
             {
                 Logger.WriteLine("Exporting '{0}' to '{1}'", this.TmxFilePath, this.UnityExportFolderPath);
                 TiledMapExporter exporter = new TiledMapExporter(this.TmxMap);
                 exporter.Export(this.UnityExportFolderPath);
             }
             catch (TmxException tmx)
             {
                 Logger.WriteError(tmx.Message);
             }
             catch (Exception e)
             {
                 Logger.WriteError(e.Message);
             }
         }
     }
     this.summaryReport.Report();
 }
Пример #2
0
        // Scripting main
        static void Main(string[] args)
        {
            SetCulture();

            // Default options
            Program.Scale                 = 1.0f;
            Program.TexelBias             = DefaultTexelBias;
            Program.Verbose               = false;
            Program.Help                  = false;
            Program.TmxPath               = "";
            Program.ExportUnityProjectDir = "";

            bool success = ParseOptions(args);

            if (success && !Program.Help)
            {
                if (String.IsNullOrEmpty(Program.ExportUnityProjectDir))
                {
                    Console.Error.WriteLine("UNITYDIR is missing!");
                    PrintHelp();
                    return;
                }

                // We should have everyting we need to export a TMX file to a Unity project
                TmxMap           tmxMap           = TmxMap.LoadFromFile(Program.TmxPath);
                TiledMapExporter tiledMapExporter = new TiledMapExporter(tmxMap);
                tiledMapExporter.Export(Program.ExportUnityProjectDir);
            }
        }
Пример #3
0
        // Scripting main
        static void Main(string[] args)
        {
            SetCulture();

            // Default options
            Program.Scale = 1.0f;
            Program.TexelBias = DefaultTexelBias;
            Program.Verbose = false;
            Program.Help = false;
            Program.TmxPath = "";
            Program.ExportUnityProjectDir = "";

            bool success = ParseOptions(args);

            if (success && !Program.Help)
            {
                if (String.IsNullOrEmpty(Program.ExportUnityProjectDir))
                {
                    Console.Error.WriteLine("UNITYDIR is missing!");
                    PrintHelp();
                    return;
                }

                // We should have everyting we need to export a TMX file to a Unity project
                TmxMap tmxMap = TmxMap.LoadFromFile(Program.TmxPath);
                TiledMapExporter tiledMapExporter = new TiledMapExporter(tmxMap);
                tiledMapExporter.Export(Program.ExportUnityProjectDir);
            }
        }
Пример #4
0
    // Use this for initialization
    void Start()
    {
        var map = Tiled2Unity.TmxMap.LoadFromFile(pat);

        Tiled2Unity.TiledMapExporter w = new Tiled2Unity.TiledMapExporter(map);
        w.Export("");
        // GetComponent<MeshRenderer>().material = w.Materials[0];
    }
Пример #5
0
        void TmxMap_OnReadTmxFileCompleted(TmxMap tmxMap)
        {
            this.buttonFolderBrowser.Enabled = true;
            this.buttonViewer.Enabled        = true;
            CheckExportButton();
            string exportDir = global::Tiled2Unity.Properties.Settings.Default.LastExportDirectory;

            if (Program.Cli && Directory.Exists(exportDir))
            {
                this.tmxExporter = new TiledMapExporter(tmxMap);
                this.tmxExporter.Export(exportDir);
                Application.Exit();
            }
        }
Пример #6
0
        private void OpenTmxFile(string tmxPath)
        {
            this.warnings.Clear();
            this.errors.Clear();

            this.buttonFolderBrowser.Enabled = false;
            this.buttonViewer.Enabled        = false;
            this.buttonExport.Enabled        = false;

            try
            {
                this.tmxMap      = TmxMap.LoadFromFile(tmxPath);
                this.tmxExporter = new TiledMapExporter(this.tmxMap);
                CheckExportButton();
                ReportSummary();
            }
            catch (TmxException tmx)
            {
                Program.WriteError(tmx.Message);
            }
        }
Пример #7
0
        private void OpenTmxFile(string tmxPath)
        {
            this.warnings.Clear();
            this.errors.Clear();

            this.buttonFolderBrowser.Enabled = false;
            this.buttonViewer.Enabled        = false;
            this.buttonExport.Enabled        = false;

            try
            {
                // Load the TMX file and its dependencies, including the Object Type Xml file used.
                this.tmxMap = TmxMap.LoadFromFile(tmxPath);
                this.tmxMap.LoadObjectTypeXml(Program.ObjectTypeXml);

                this.tmxExporter = new TiledMapExporter(this.tmxMap);
                CheckExportButton();
                ReportSummary("Compilation complete");
            }
            catch (TmxException tmx)
            {
                Program.WriteError(tmx.Message);
            }
        }
Пример #8
0
        // Scripting main
        static void Main(string[] args)
        {
            SetCulture();

            // Listen to any success, warning, and error messages. Give a report when finished.
            List<string> errors = new List<string>();
            Action<string> funcError = delegate(string line)
            {
                errors.Add(line);
            };

            List<string> warnings = new List<string>();
            Action<string> funcWaring = delegate(string line)
            {
                warnings.Add(line);
            };

            List<string> successes = new List<string>();
            Action<string> funcSuccess = delegate(string line)
            {
                successes.Add(line);
            };

            // Temporarily capture output while exporting
            Program.OnWriteError += new Program.WriteErrorDelegate(funcError);
            Program.OnWriteWarning += new Program.WriteWarningDelegate(funcWaring);
            Program.OnWriteSuccess += new Program.WriteSuccessDelegate(funcSuccess);

            // Default options
            Program.Scale = 1.0f;
            Program.PreferConvexPolygons = false;
            Program.TexelBias = DefaultTexelBias;
            Program.Verbose = false;
            Program.Help = false;
            Program.TmxPath = "";
            Program.ExportUnityProjectDir = "";

            bool success = ParseOptions(args);

            if (success && !Program.Help)
            {
                if (String.IsNullOrEmpty(Program.ExportUnityProjectDir))
                {
                    Console.Error.WriteLine("UNITYDIR is missing!");
                    PrintHelp();
                    return;
                }

                // We should have everyting we need to export a TMX file to a Unity project
                TmxMap tmxMap = TmxMap.LoadFromFile(Program.TmxPath);
                tmxMap.LoadObjectTypeXml(Program.ObjectTypeXml);
                TiledMapExporter tiledMapExporter = new TiledMapExporter(tmxMap);
                tiledMapExporter.Export(Program.ExportUnityProjectDir);

                // Write a summary that repeats warnings and errors
                Console.WriteLine("----------------------------------------");
                Console.WriteLine("Export completed");
                foreach (string msg in successes)
                {
                    Console.WriteLine(msg);
                }

                Console.WriteLine("Warnings: {0}", warnings.Count);
                foreach (string warning in warnings)
                {
                    Console.WriteLine(warning);
                }
            
                Console.Error.WriteLine("Errors: {0}\n", errors.Count);
                foreach (string error in errors)
                {
                    Console.WriteLine(error);
                }
                Console.WriteLine("----------------------------------------");
            }
        }
Пример #9
0
 void TmxMap_OnReadTmxFileCompleted(TmxMap tmxMap)
 {
     this.buttonFolderBrowser.Enabled = true;
     this.buttonViewer.Enabled = true;
     CheckExportButton();
     string exportDir = global::Tiled2Unity.Properties.Settings.Default.LastExportDirectory;
     if (Program.Cli && Directory.Exists(exportDir)) {
         this.tmxExporter = new TiledMapExporter(tmxMap);
         this.tmxExporter.Export(exportDir);
         Application.Exit ();
     }
 }
Пример #10
0
        private void OpenTmxFile(string tmxPath)
        {
            this.warnings.Clear();
            this.errors.Clear();

            this.buttonFolderBrowser.Enabled = false;
            this.buttonViewer.Enabled = false;
            this.buttonExport.Enabled = false;

            try
            {
                this.tmxMap = TmxMap.LoadFromFile(tmxPath);
                this.tmxExporter = new TiledMapExporter(this.tmxMap);
                CheckExportButton();
                ReportSummary();
            }
            catch (TmxException tmx)
            {
                Program.WriteError(tmx.Message);
            }
        }
Пример #11
0
        private void OpenTmxFile(string tmxPath)
        {
            this.warnings.Clear();
            this.errors.Clear();

            this.buttonFolderBrowser.Enabled = false;
            this.buttonViewer.Enabled = false;
            this.buttonExport.Enabled = false;
            this.txtSource.Text = tmxPath;

            try
            {
                // Load the TMX file and its dependencies, including the Object Type Xml file used.
                this.tmxMap = TmxMap.LoadFromFile(tmxPath);
                this.tmxMap.LoadObjectTypeXml(Program.ObjectTypeXml);

                this.tmxExporter = new TiledMapExporter(this.tmxMap);
                CheckExportButton();
                ReportSummary("Compilation complete");

                Properties.Settings.Default.LastSourceFile = tmxPath;
                Properties.Settings.Default.Save();
            }
            catch (TmxException tmx)
            {
                Program.WriteError(tmx.Message);
            }
        }
Пример #12
0
        // Scripting main
        static void Main(string[] args)
        {
            SetCulture();

            // Listen to any success, warning, and error messages. Give a report when finished.
            List <string>   errors    = new List <string>();
            Action <string> funcError = delegate(string line)
            {
                errors.Add(line);
            };

            List <string>   warnings   = new List <string>();
            Action <string> funcWaring = delegate(string line)
            {
                warnings.Add(line);
            };

            List <string>   successes   = new List <string>();
            Action <string> funcSuccess = delegate(string line)
            {
                successes.Add(line);
            };

            // Temporarily capture output while exporting
            Program.OnWriteError   += new Program.WriteErrorDelegate(funcError);
            Program.OnWriteWarning += new Program.WriteWarningDelegate(funcWaring);
            Program.OnWriteSuccess += new Program.WriteSuccessDelegate(funcSuccess);

            // Default options
            Program.Scale = 1.0f;
            Program.PreferConvexPolygons = false;
            Program.TexelBias            = DefaultTexelBias;
            Program.Verbose = false;
            Program.Help    = false;
            Program.TmxPath = "";
            Program.ExportUnityProjectDir = "";

            bool success = ParseOptions(args);

            if (success && !Program.Help)
            {
                if (String.IsNullOrEmpty(Program.ExportUnityProjectDir))
                {
                    Console.Error.WriteLine("UNITYDIR is missing!");
                    PrintHelp();
                    return;
                }

                // We should have everyting we need to export a TMX file to a Unity project
                TmxMap tmxMap = TmxMap.LoadFromFile(Program.TmxPath);
                tmxMap.LoadObjectTypeXml(Program.ObjectTypeXml);
                TiledMapExporter tiledMapExporter = new TiledMapExporter(tmxMap);
                tiledMapExporter.Export(Program.ExportUnityProjectDir);

                // Write a summary that repeats warnings and errors
                Console.WriteLine("----------------------------------------");
                Console.WriteLine("Export completed");
                foreach (string msg in successes)
                {
                    Console.WriteLine(msg);
                }

                Console.WriteLine("Warnings: {0}", warnings.Count);
                foreach (string warning in warnings)
                {
                    Console.WriteLine(warning);
                }

                Console.Error.WriteLine("Errors: {0}\n", errors.Count);
                foreach (string error in errors)
                {
                    Console.WriteLine(error);
                }
                Console.WriteLine("----------------------------------------");
            }
        }