private void Core_SaveRequested(object sender, SavingEventArgs e) { // Saves game (autosave). SavegameManager.SaveAuto(); // If e.CloseAfterSave, close the game. if (e.CloseAfterSave) { // Wait for the engine to be done doing what it's doing. BeginRunOnIdle(() => { // Shows a message box for that. System.Windows.MessageBox.Show("The cartridge has requested to be terminated. The game has been automatically saved, and you will now be taken back to the main menu of the app.", "The game is ending.", MessageBoxButton.OK); // Back to app home. NavigationManager.NavigateToAppHome(true); }); } }
/// <summary> /// Makes a custom savegame and prompts the user for a name. /// </summary> public void SaveGame() { SavegameManager.SaveAndPrompt(); }
/// <summary> /// Makes a quick save of the current game. /// </summary> public void SaveGameQuick() { SavegameManager.SaveQuick(); }
/// <summary> /// Called when a game started. /// </summary> /// <param name="tag">Cartridge that started.</param> /// <param name="savegame">Optional savegame restored when the game started.</param> public void HandleGameStarted(CartridgeTag tag, CartridgeSavegame savegame = null) { // Resets the session quick save. SavegameManager.InitSessionSavegames(tag, savegame); }