예제 #1
0
        /// <summary>
        /// Start a new session, using the data in the given save game
        /// </summary>
        /// <param name="aSaveGameDescription">The description of the save game</param>
        /// <param name="aScreenManager">The screen manager for the new session</param>
        /// <param name="aGameplayScreen"></param>
        public static void LoadSession(SaveGameDescription aSaveGameDescription,
                                       ScreenManager aScreenManager, GameplayScreen aGameplayScreen)
        {
            if (aSaveGameDescription == null)
            {
                throw new ArgumentNullException("saveGameDescription");
            }
            if (aScreenManager == null)
            {
                throw new ArgumentNullException("screenManager");
            }
            if (aGameplayScreen == null)
            {
                throw new ArgumentNullException("gameplayScreen");
            }

            //Exit any existing session
            EndSession();

            //Create the new session
            mSingleton = new Session(aScreenManager, aGameplayScreen);

            //Get the storage device and load the session
            GetStorageDevice(
                delegate(StorageDevice aStorageDevice)
            {
                LoadSessionResult(aStorageDevice, aSaveGameDescription);
            });
        }
예제 #2
0
 /// <summary>
 /// Save the current state of the session.
 /// </summary>
 /// <param name="aOverwriteDescription">The description of the save game to over-write, if any.</param>
 public static void SaveSession(SaveGameDescription aOverwriteDescription)
 {
     //Retrieve the storage device, asynchronously
     GetStorageDevice(delegate(StorageDevice aStorageDevice)
     {
         SaveSessionResult(aStorageDevice, aOverwriteDescription);
     });
 }
예제 #3
0
        /// <summary>
        /// Save the current state of the session, with the given storage device.
        /// </summary>
        /// <param name="aStorageDevice">The chosen storage device.</param>
        /// <param name="aOverwriteDescription">The description of the game to over-write, if any</param>
        private static void SaveSessionResult(StorageDevice aStorageDevice, SaveGameDescription aOverwriteDescription)
        {
            if ((aStorageDevice == null) || !aStorageDevice.IsConnected)
            {
                return;
            }


            //TODO: Save session data here
        }
예제 #4
0
        /// <summary>
        /// Receives the storage device and starts a new session, using
        /// the data in the given save game.
        /// </summary>
        /// <remarks>
        /// The new Session is created in LoadSessionResult
        /// </remarks>
        /// <param name="aStorageDevice">The chosen storage device.</param>
        /// <param name="aSaveGameDescription">The description of the save game.</param>
        public static void LoadSessionResult(StorageDevice aStorageDevice, SaveGameDescription aSaveGameDescription)
        {
            if (aSaveGameDescription == null)
            {
                throw new ArgumentNullException("saveGameDescription");
            }
            if (aStorageDevice == null || !aStorageDevice.IsConnected)
            {
                return;
            }

            //TODO: Load saved game
        }
예제 #5
0
        /// <summary>
        /// Delete the saved game specified by the description.
        /// </summary>
        /// <param name="aStorageDevice">The chosen storage device</param>
        /// <param name="aSaveGameDescription">The description of the saved game.</param>
        public static void DeleteSaveGameResult(StorageDevice aStorageDevice,
                                                SaveGameDescription aSaveGameDescription)
        {
            if (aSaveGameDescription == null)
            {
                throw new ArgumentNullException("saveGameDescription");
            }
            if ((aStorageDevice == null) || !aStorageDevice.IsConnected)
            {
                return;
            }

            //TODO: Delete saved game file here
        }
예제 #6
0
        /// <summary>
        /// Delete the saved game specified by the description
        /// </summary>
        /// <param name="aSaveGameDescription"></param>
        public static void DeleteSaveGame(SaveGameDescription aSaveGameDescription)
        {
            if (aSaveGameDescription == null)
            {
                throw new ArgumentNullException("saveGameDescription");
            }

            //Get the storage device to delete the saved game
            GetStorageDevice(
                delegate(StorageDevice aStorageDevice)
            {
                DeleteSaveGameResult(aStorageDevice, aSaveGameDescription);
            });
        }
예제 #7
0
 /// <summary>
 /// Create a new GameplayScreen from a saved-game description
 /// </summary>
 /// <param name="aSaveGameDescription"></param>
 public GameplayScreen(SaveGameDescription aSaveGameDescription)
     : this()
 {
     this.mGameStartDescription = null;
     this.mSaveGameDescription = aSaveGameDescription;
 }
예제 #8
0
 /// <summary>
 /// Create a new GameplayScreen from a new-game description
 /// </summary>
 /// <param name="aGameStartDescription"></param>
 public GameplayScreen(GameStartDescription aGameStartDescription)
     : this()
 {
     mGameStartDescription = aGameStartDescription;
     mSaveGameDescription = null;
 }
예제 #9
0
 /// <summary>
 /// Create a new GameplayScreen from a saved-game description
 /// </summary>
 /// <param name="aSaveGameDescription"></param>
 public GameplayScreen(SaveGameDescription aSaveGameDescription)
     : this()
 {
     this.mGameStartDescription = null;
     this.mSaveGameDescription  = aSaveGameDescription;
 }
예제 #10
0
 /// <summary>
 /// Create a new GameplayScreen from a new-game description
 /// </summary>
 /// <param name="aGameStartDescription"></param>
 public GameplayScreen(GameStartDescription aGameStartDescription)
     : this()
 {
     mGameStartDescription = aGameStartDescription;
     mSaveGameDescription  = null;
 }