/** This method is closing game and save game */ @Override public void windowClosing(WindowEvent e) { String message = "Do you want to save game information?"; String title = "Save Game?"; int reply = JOptionPane.showConfirmDialog(null, message, title, JOptionPane.YES_NO_OPTION); if (reply == JOptionPane.NO_OPTION) { String[] mapname = this.file.getName().split("\\."); File loadmap = new File("logfile/" + mapname[0] + ".log"); String content = "is played"; LogGenerator.addMapLog(loadmap, mapname[0], content, ConfigModel.money); System.exit(0); } else if (reply == JOptionPane.YES_OPTION) { // String str = JOptionPane.showInputDialog(this, "Enter File Name"); // new FileOutputStream("savegameinfo/"+str+".dat"), "utf-8")); // System.out.println("save game"); slzModel = new Serialization_model( this.file, ConfigModel.money, ConfigModel.killed, ConfigModel.total_killed, ConfigModel.health, ConfigModel.waveLap, ConfigModel.level, gcModel); String[] mapname = this.file.getName().split("\\."); File loadmap = new File("logfile/" + mapname[0] + ".log"); String content = "is saved"; LogGenerator.addMapLog(loadmap, mapname[0], content, ConfigModel.money); this.dispose(); System.exit(0); } }
/** @param args */ public static void main(final String[] args) { int variant = getVariant(args); applicationContext = new ClassPathXmlApplicationContext("spring/application-context.xml"); final LogGeneratorFactory logGeneratorFactory = getBean(LogGeneratorFactory.class); final LogGenerator logGenerator = logGeneratorFactory.newInstance(variant); logGenerator.generate(1); }