Ejemplo n.º 1
0
        public static List <object> GetAllPossibleLevelsFull()
        {
            List <object> ret    = new List <object>();
            List <uint>   levels = GetAllPossibleLevels();

            foreach (uint u in levels)
            {
                ret.Add(new LevelInfo(XmlLevelParser.GetLevelFileName((uint)u), false));
            }
            return(ret);
        }
Ejemplo n.º 2
0
        private static List <uint> GetAllPossibleLevels()
        {
            List <uint> completedLevels = new List <uint>();

            uint i = 0;

            while (File.Exists(XmlLevelParser.GetLevelFileName(++i)))
            {
                completedLevels.Add((uint)i);
            }
            return(completedLevels);
        }
Ejemplo n.º 3
0
        public static CompletedLevelsInfo GetCompletedLevels()
        {
            CompletedLevelsInfo completedLevels = new CompletedLevelsInfo();

            completedLevels.CompletedLevels = new SerializableDictionary <LevelInfo, List <Achievement> >();

            List <Achievement> emptyAchievements = new List <Achievement>();

            if (!File.Exists(EngineConfig.C_COMPLETED_LEVELS_FILE))
            {
                completedLevels = CompletedLevelsInfo.GetDefaultCompletedLevelsInfo();
                return(completedLevels);
            }
            else
            {
                try
                {
                    string levelsRaw    = File.ReadAllText(EngineConfig.C_COMPLETED_LEVELS_FILE);
                    string levelsString = RijndaelSimple.Decrypt(levelsRaw);

                    using (Stream stream = GenerateStreamFromString(levelsString))
                    {
                        XmlSerializer serializer = new XmlSerializer(typeof(CompletedLevelsInfo));
                        ;
                        var levels = ( CompletedLevelsInfo)serializer.Deserialize(stream);
                        return(levels as CompletedLevelsInfo);
                    }
                }
                catch (Exception ex)
                {
                    completedLevels.CompletedLevels.Clear();
                    completedLevels.CompletedLevels.Add(new LevelInfo(XmlLevelParser.GetLevelFileName(1), false), emptyAchievements);
                    Console.WriteLine(ex);
                }


                return(completedLevels);
            }
        }
Ejemplo n.º 4
0
 public LevelInfo(uint levelNo)
 {
     this.filename = XmlLevelParser.GetLevelFileName(levelNo);
     this.isCustom = false;
 }