示例#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
        // 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("----------------------------------------");
            }
        }
示例#6
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("----------------------------------------");
            }
        }