protected override void LoadContent() { ScreenSize = new Vector2(graphics.PreferredBackBufferWidth, graphics.PreferredBackBufferHeight); spriteBatch = new SpriteBatch(GraphicsDevice); Imgs.Load(base.Content); font = base.Content.Load<SpriteFont>("font"); font2 = base.Content.Load<SpriteFont>("font2"); font3 = base.Content.Load<SpriteFont>("font3"); if (!Directory.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\ClickerClicker\save")) { Directory.CreateDirectory(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\ClickerClicker\save"); } if (File.Exists(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\ClickerClicker\save\savadat.data")) { using (FileStream stream = File.Open(Environment.GetFolderPath(Environment.SpecialFolder.MyDocuments) + @"\ClickerClicker\save\savadat.data", FileMode.Open)) { using (BinaryReader reader = new BinaryReader(stream)) { TryAddGame(reader, new ClickerClicker(Imgs.clickers[0])); } } } else { clickerGames = new List<ClickerGame>(); clickerGames.Add(new ClickerClicker(Imgs.clickers[0])); clickerGames.Add(new NearlyNoGraphicsClicker()); current = clickerGames[0]; } }
private static void TryAddGame(BinaryReader reader, ClickerGame game) { try { game.Load(reader); } catch { } clickerGames.Add(game); }