コード例 #1
0
        /// <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());
        }
コード例 #2
0
ファイル: Game1.cs プロジェクト: Jorgemagic/MonoGame
        /// <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());
        }
コード例 #3
0
ファイル: Game1.cs プロジェクト: jdindia/MonoGame
        /// <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();
        }
コード例 #4
0
ファイル: Game1.cs プロジェクト: Nailz/MonoGame-Samples
        /// <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();		
        }