/// <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); }); }
/// <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); }); }
/// <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 }
/// <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 }
/// <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 }
/// <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); }); }
/// <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; }
/// <summary> /// Create a new GameplayScreen from a new-game description /// </summary> /// <param name="aGameStartDescription"></param> public GameplayScreen(GameStartDescription aGameStartDescription) : this() { mGameStartDescription = aGameStartDescription; mSaveGameDescription = null; }