/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); // Save Game Data SaveGameStorage storage = new SaveGameStorage(); SaveGame sg = new SaveGame(); sg.Name = "Ziggy"; sg.HiScore = 1000; sg.Date = DateTime.Now; sg.DontKeep = 123; storage.Save(sg); //load the data back in to test if it was successful SaveGame loaded = storage.Load(); Console.WriteLine("Name: " + loaded.Name); Console.WriteLine("Hi Score: " + loaded.HiScore.ToString()); Console.WriteLine("Date: " + loaded.Date.ToString()); Console.WriteLine("Dont Keep: " + loaded.DontKeep.ToString()); }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { // TODO: Add your initialization logic here base.Initialize(); // Save Game Data SaveGameStorage storage = new SaveGameStorage(); SaveGame sg = new SaveGame(); sg.Name = "Ziggy"; sg.HiScore = 1000; sg.Date = DateTime.Now; sg.DontKeep = 123; storage.Save(sg); //load the data back in to test if it was successful loaded = storage.Load(); }