/// <summary>
        /// Get map informations (.tgpa files)
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public static MapOverview GetMapOverview(String file)
        {
            MapOverview overview = new MapOverview();

            overview.Filename = file;

            StreamReader reader = new StreamReader(file);

            String line = reader.ReadLine();

            while (line.Equals("") || line.StartsWith("//"))
            {
                line = reader.ReadLine();
            }

            //Check version
            if (Convert.ToDouble((line.Split(' '))[1]) > Convert.ToDouble(TheGreatPaperGame.version))
            {
                throw new Exception("Insupported game version.");
            }

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//"))
            {
                line = reader.ReadLine();
            }

            //Map informations
            overview.Level = Convert.ToInt32((line.Split(' '))[1]);

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//"))
            {
                line = reader.ReadLine();
            }

            overview.Name = line.Replace("name ", "");

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//"))
            {
                line = reader.ReadLine();
            }

            String filedesc = line.Replace("desc ", "");
            String s        = Localization.GetString(filedesc);

            overview.Description = s == null ? filedesc : s;

            reader.Close();

            //Load scores for this map
            // overview.Scores = Highscores.LoadScores(file.Replace(".tgpa", ".esd"));

            return(overview);
        }
        public LoadingScreen(MapOverview overview, TheGreatPaperGame Game)
        {
            this.Initialize();
            this.Game = Game;

            loading1 = new Rectangle(0, 356, 270, 178);
            loading2 = new Rectangle(0, 178, 270, 178);
            loading3 = new Rectangle(0, 0, 270, 178);
            currentloading = loading1;

            background = new Rectangle(300, 0, 1024, 768);
            backgroundDst = background;
            backgroundDst.X = 0;
            backgroundDst.Y = 0;
            backgroundDst.Width = TGPAContext.Instance.ScreenWidth;
            backgroundDst.Height = TGPAContext.Instance.ScreenHeight;

            this.overview = overview;
            this.previewBG1 = null;
            this.previewBG1Fadeout = 0.0f;
            this.previewBG2 = null;
            this.previewBG2Fadeout = 0.0f;
            this.IsLoaded = false;
        }
Example #3
0
        /// <summary>
        /// Get map informations (.tgpa files)
        /// </summary>
        /// <param name="file"></param>
        /// <returns></returns>
        public static MapOverview GetMapOverview(String file)
        {
            MapOverview overview = new MapOverview();
            overview.Filename = file;

            StreamReader reader = new StreamReader(file);

            String line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//")) line = reader.ReadLine();

            //Check version
            //if (Convert.ToDouble((line.Split(' '))[1]) > Convert.ToDouble(TheGreatPaperGame.version.Replace('.',','))
            //    throw new Exception("Insupported game version.");

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//")) line = reader.ReadLine();

            //Map informations
            overview.Level = Convert.ToInt32((line.Split(' '))[1]);

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//")) line = reader.ReadLine();

            try
            {
                overview.Lastpart = Convert.ToBoolean(line.Replace("lastpart ", ""));
            }
            catch (FormatException) { reader.Close(); throw new Exception("Invalid map level lastpart : " + line); }

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//")) line = reader.ReadLine();

            overview.Name = LocalizedStrings.GetString(line.Replace("name ", ""));

            line = reader.ReadLine();
            while (line.Equals("") || line.StartsWith("//")) line = reader.ReadLine();

            String filedesc = line.Replace("desc ", "");
            String s = LocalizedStrings.GetString(filedesc);
            overview.Description = s == null ? filedesc : s;

            reader.Close();

            //Load scores for this map
            // overview.Scores = Highscores.LoadScores(file.Replace(".tgpa", ".esd"));

            return overview;
        }
        /// <summary>
        /// Reload map overviews
        /// </summary>
        private MapOverview LoadOverview(int level)
        {
            String mapFile = World.GetMapFirstFile(level);
            overviewIndex = level;
            overview = Map.GetMapOverview(mapFile);
            levelParts = World.GetMaps(level);

            return overview;
        }