mirror of
https://github.com/correl/mage.git
synced 2024-11-25 11:09:53 +00:00
UI: fixed rare error with game end dialog;
This commit is contained in:
parent
e768c375dc
commit
4c55fe701e
1 changed files with 276 additions and 277 deletions
|
@ -5,34 +5,31 @@
|
||||||
*
|
*
|
||||||
* Created on Jul 31, 2013, 9:41:00 AM
|
* Created on Jul 31, 2013, 9:41:00 AM
|
||||||
*/
|
*/
|
||||||
package mage.client.dialog;
|
package mage.client.dialog;
|
||||||
|
|
||||||
import java.awt.Color;
|
import mage.client.MageFrame;
|
||||||
import java.awt.Image;
|
import mage.client.game.GamePanel;
|
||||||
import java.awt.Rectangle;
|
import mage.client.util.Format;
|
||||||
import java.awt.image.BufferedImage;
|
import mage.client.util.ImageHelper;
|
||||||
import java.io.File;
|
import mage.client.util.audio.AudioManager;
|
||||||
import java.io.FileNotFoundException;
|
import mage.client.util.gui.BufferedImageBuilder;
|
||||||
import java.io.PrintWriter;
|
import mage.view.GameEndView;
|
||||||
import java.text.DateFormat;
|
import mage.view.PlayerView;
|
||||||
import java.text.SimpleDateFormat;
|
|
||||||
import java.util.Calendar;
|
|
||||||
import javax.swing.ImageIcon;
|
|
||||||
import javax.swing.JOptionPane;
|
|
||||||
import mage.client.MageFrame;
|
|
||||||
import mage.client.game.GamePanel;
|
|
||||||
import mage.client.util.Format;
|
|
||||||
import mage.client.util.ImageHelper;
|
|
||||||
import mage.client.util.audio.AudioManager;
|
|
||||||
import mage.client.util.gui.BufferedImageBuilder;
|
|
||||||
import mage.view.GameEndView;
|
|
||||||
import mage.view.PlayerView;
|
|
||||||
|
|
||||||
/**
|
import javax.swing.*;
|
||||||
*
|
import java.awt.*;
|
||||||
|
import java.awt.image.BufferedImage;
|
||||||
|
import java.io.File;
|
||||||
|
import java.io.FileNotFoundException;
|
||||||
|
import java.io.PrintWriter;
|
||||||
|
import java.text.DateFormat;
|
||||||
|
import java.text.SimpleDateFormat;
|
||||||
|
import java.util.Calendar;
|
||||||
|
|
||||||
|
/**
|
||||||
* @author LevelX2
|
* @author LevelX2
|
||||||
*/
|
*/
|
||||||
public class GameEndDialog extends MageDialog {
|
public class GameEndDialog extends MageDialog {
|
||||||
|
|
||||||
private final DateFormat df = DateFormat.getDateTimeInstance();
|
private final DateFormat df = DateFormat.getDateTimeInstance();
|
||||||
|
|
||||||
|
@ -97,6 +94,7 @@ public class GameEndDialog extends MageDialog {
|
||||||
}
|
}
|
||||||
// get game log
|
// get game log
|
||||||
try {
|
try {
|
||||||
|
if (gameEndView.getMatchView().getGames().size() > 0) {
|
||||||
GamePanel gamePanel = MageFrame.getGame(gameEndView.getMatchView().getGames().get(gameEndView.getMatchView().getGames().size() - 1));
|
GamePanel gamePanel = MageFrame.getGame(gameEndView.getMatchView().getGames().get(gameEndView.getMatchView().getGames().size() - 1));
|
||||||
if (gamePanel != null) {
|
if (gamePanel != null) {
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat();
|
SimpleDateFormat sdf = new SimpleDateFormat();
|
||||||
|
@ -110,6 +108,7 @@ public class GameEndDialog extends MageDialog {
|
||||||
out.print(gamePanel.getGameLog());
|
out.print(gamePanel.getGameLog());
|
||||||
out.close();
|
out.close();
|
||||||
}
|
}
|
||||||
|
}
|
||||||
} catch (FileNotFoundException ex) {
|
} catch (FileNotFoundException ex) {
|
||||||
JOptionPane.showMessageDialog(this, "Error while writing game log to file\n\n" + ex, "Error writing gamelog", JOptionPane.ERROR_MESSAGE);
|
JOptionPane.showMessageDialog(this, "Error while writing game log to file\n\n" + ex, "Error writing gamelog", JOptionPane.ERROR_MESSAGE);
|
||||||
}
|
}
|
||||||
|
@ -323,4 +322,4 @@ public class GameEndDialog extends MageDialog {
|
||||||
private javax.swing.JLabel txtPlayerInfo;
|
private javax.swing.JLabel txtPlayerInfo;
|
||||||
// End of variables declaration//GEN-END:variables
|
// End of variables declaration//GEN-END:variables
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue