public void TmxImported(string tmxPath)
        {
            List <string> args = new List <string>();

            Environment.SetEnvironmentVariable("TILED2UNITY_TMXPATH", tmxPath);
            Environment.SetEnvironmentVariable("TILED2UNITY_UNITYDIR", Application.dataPath + "/Tiled2Unity");

            args.Insert(0, tmxPath);
            args.Insert(1, Application.dataPath + "/Tiled2Unity");

            Tiled2UnityLite.Run(args.ToArray());

            string mapName = tmxPath.Substring(tmxPath.LastIndexOf('/') + 1, tmxPath.Length - tmxPath.LastIndexOf(".tmx"));

            AssetDatabase.Refresh();
            AssetDatabase.ImportAsset("Assets/Tiled2Unity/Imported/" + mapName + ".tiled2unity.xml");
        }
Exemplo n.º 2
0
        static int Main(string[] args)
        {
            bool isAuto = false;

            NDesk.Options.OptionSet options = new NDesk.Options.OptionSet()
            {
                { "a|auto-export", "Automatic export", a => isAuto = true }
            };

            options.Parse(args);
            if (isAuto)
            {
                return(Tiled2UnityLite.Run(args));
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            using (Tiled2UnityForm form = new Tiled2UnityForm())
            {
                Application.Run(form);
            }

            return(0);
        }