private void jButton1ActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_jButton1ActionPerformed optionsDialog.setVisible(false); optionsButton.setEnabled(false); endTurnButton.setEnabled(false); manager.currentGame.isAlive = false; manager.currentGame.stats.calculateEndGameData(); manager.currentGame.stats.user = manager.currentUser[0].userName; UserDataHandler.RemoveCrossGame(manager.currentUser[0], manager.currentGame.name); UserDataHandler.SaveGameStatistics(manager.currentUser[0], manager.currentGame); UserDataHandler.SaveUserData(manager.currentUser[0]); if (manager.currentGame.twoPlayers) { manager.currentGame.stats.user = manager.currentUser[1].userName; UserDataHandler.RemoveCrossGame(manager.currentUser[1], manager.currentGame.name); UserDataHandler.SaveGameStatistics(manager.currentUser[1], manager.currentGame); UserDataHandler.SaveUserData(manager.currentUser[0]); } timeCompLabel.setText( manager.currentGame.stats.getTimeElapsed(manager.currentGame.stats.endDate)); finalScoreLabel.setText(Integer.toString(manager.currentGame.stats.score)); wordsCompLabel.setText(Integer.toString(manager.currentGame.stats.wordComp)); endGameDialog.pack(); endGameDialog.setLocationRelativeTo(this); endGameDialog.setVisible(true); } // GEN-LAST:event_jButton1ActionPerformed
private void saveExitButtonActionPerformed( java.awt.event.ActionEvent evt) { // GEN-FIRST:event_saveExitButtonActionPerformed if (manager.currentGame.twoPlayers) { UserDataHandler.SaveCrossGame(manager.currentUser[0], manager.currentGame); UserDataHandler.SaveCrossGame(manager.currentUser[1], manager.currentGame); UserDataHandler.SaveUserData(manager.currentUser[0]); UserDataHandler.SaveUserData(manager.currentUser[1]); } else { UserDataHandler.SaveCrossGame(manager.currentUser[0], manager.currentGame); UserDataHandler.SaveUserData(manager.currentUser[0]); } optionsDialog.setVisible(false); manager.ReplacePanel(new MenuPanel(), 400, 300); } // GEN-LAST:event_saveExitButtonActionPerformed