Example #1
0
        public static TmxMap LoadFromFile(string tmxPath)
        {
            // Refresh uniqueId counter
            TmxMap.NextUniqueId = 0;

            string fullTmxPath = Path.GetFullPath(tmxPath);

            using (ChDir chdir = new ChDir(fullTmxPath))
            {
                TmxMap    tmxMap = new TmxMap();
                XDocument doc    = tmxMap.LoadDocument(fullTmxPath);

                tmxMap.Name = Path.GetFileNameWithoutExtension(fullTmxPath);
                tmxMap.ParseMap(doc);

                // We're done reading and parsing the tmx file
                Program.WriteLine("Map details: {0}", tmxMap.ToString());
                Program.WriteSuccess("Finished parsing file: {0}", fullTmxPath);

                // Let listeners know of our success
                if (TmxMap.OnReadTmxFileCompleted != null)
                {
                    TmxMap.OnReadTmxFileCompleted(tmxMap);
                }

                return(tmxMap);
            }
        }
Example #2
0
        public static TmxMap LoadFromFile(string tmxPath)
        {
            // Refresh uniqueId counter
            TmxMap.NextUniqueId = 0;

            string fullTmxPath = Path.GetFullPath(tmxPath);
            using (ChDir chdir = new ChDir(fullTmxPath))
            {
                TmxMap tmxMap = new TmxMap();
                XDocument doc = tmxMap.LoadDocument(fullTmxPath);

                tmxMap.Name = Path.GetFileNameWithoutExtension(fullTmxPath);
                tmxMap.ParseMap(doc);

                // We're done reading and parsing the tmx file
                Program.WriteLine("Map details: {0}", tmxMap.ToString());
                Program.WriteSuccess("Finished parsing file: {0}", fullTmxPath);

                // Let listeners know of our success
                if (TmxMap.OnReadTmxFileCompleted != null)
                {
                    TmxMap.OnReadTmxFileCompleted(tmxMap);
                }

                return tmxMap;
            }
        }
Example #3
0
        private void ParseExternalTileset(string tsxPath, uint firstId)
        {
            string fullTsxPath = Path.GetFullPath(tsxPath);

            using (ChDir chdir = new ChDir(fullTsxPath))
            {
                XDocument tsx = LoadDocument(fullTsxPath);
                ParseInternalTileset(tsx.Root, firstId);
            }
        }
        private void ParseExternalTileset(string tsxPath, uint firstId)
        {
            string fullTsxPath = Path.GetFullPath(tsxPath);

            if (File.Exists(fullTsxPath))
            {
                using (ChDir chdir = new ChDir(fullTsxPath))
                {
                    XDocument tsx = LoadDocument(fullTsxPath);
                    ParseInternalTileset(tsx.Root, firstId);
                }
            }
            else
            {
                Logger.WriteError("Tileset file does not exist: {0}", fullTsxPath);
            }
        }
Example #5
0
        public static TmxMap LoadFromFile(string tmxPath)
        {
            string fullTmxPath = Path.GetFullPath(tmxPath);
            using (ChDir chdir = new ChDir(fullTmxPath))
            {
                TmxMap tmxMap = new TmxMap();
                XDocument doc = tmxMap.LoadDocument(fullTmxPath);

                tmxMap.Name = Path.GetFileNameWithoutExtension(fullTmxPath);
                tmxMap.ParseMapXml(doc);

                // We're done reading and parsing the tmx file
                Logger.WriteLine("Map details: {0}", tmxMap.ToString());
                Logger.WriteSuccess("Parsed: {0} ", fullTmxPath);

                tmxMap.IsLoaded = true;
                return tmxMap;
            }
        }
        public static TmxMap LoadFromFile(string tmxPath)
        {
            string fullTmxPath = Path.GetFullPath(tmxPath);

            using (ChDir chdir = new ChDir(fullTmxPath))
            {
                TmxMap    tmxMap = new TmxMap();
                XDocument doc    = tmxMap.LoadDocument(fullTmxPath);

                tmxMap.Name = Path.GetFileNameWithoutExtension(fullTmxPath);
                tmxMap.ParseMapXml(doc);

                // We're done reading and parsing the tmx file
                Logger.WriteInfo("Map details: {0}", tmxMap.ToString());
                Logger.WriteSuccess("Parsed: {0} ", fullTmxPath);

                tmxMap.IsLoaded = true;
                return(tmxMap);
            }
        }
Example #7
0
 private void ParseExternalTileset(string tsxPath, uint firstId)
 {
     string fullTsxPath = Path.GetFullPath(tsxPath);
     using (ChDir chdir = new ChDir(fullTsxPath))
     {
         XDocument tsx = LoadDocument(fullTsxPath);
         ParseInternalTileset(tsx.Root, firstId);
     }
 }