Ejemplo n.º 1
0
 public static void LoadHighScores()
 {
     if (File.Exists(filePathScores))
     {
         FileStream file = new FileStream(filePathScores, FileMode.Open);
         try
         {
             BinaryFormatter      binaryFormatter = new BinaryFormatter();
             AchievementsSaveData saveData        = binaryFormatter.Deserialize(file) as AchievementsSaveData;
             Achievements.UpdateAchievements(
                 saveData.gameCompleted,
                 saveData.noDeath,
                 saveData.noHits,
                 saveData.bestTime);
             file.Close();
         }
         catch (Exception e)
         {
             Achievements.UpdateAchievements(
                 false,
                 false,
                 false,
                 0);
         }
     }
     else
     {
         Achievements.UpdateAchievements(
             false,
             false,
             false,
             0);
     }
 }
Ejemplo n.º 2
0
        static public void SaveHighScores(AchievementsSaveData achievements)
        {
            BinaryFormatter binaryFormatter = new BinaryFormatter();
            FileStream      file            = new FileStream(filePathScores, FileMode.Create);

            binaryFormatter.Serialize(file, achievements);
            file.Close();
            Achievements.UpdateAchievements(
                achievements.gameCompleted,
                achievements.noDeath,
                achievements.noHits,
                achievements.bestTime);
        }