v tride save som si vytvoril
public void execute(Game game, String path) {
try {
History.getInstance().save(path);
} catch (IOException ex) {
//Logger.getLogger(Save.class.getName()).log(Level.SEVERE, null, ex);
System.out.print(ex);
}
game.setGameState(GameState.PLAYING);
}
malo by to sluzit na ulozenie
a v triede history ulozenie array listu do suboru
public void save(String path) throws IOException{
String subor = path.trim();
if (subor.length() == 0) { subor = "save.txt"; }
File aFile = new File(subor);
aFile.createNewFile();
try {
LibraryMethods.save((ArrayList<String>) this.historyZoznam, subor);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
System.out.println("Game Saved !!");
}
public void execute(Game game, String path) {
try {
History.getInstance().save(path);
} catch (IOException ex) {
//Logger.getLogger(Save.class.getName()).log(Level.SEVERE, null, ex);
System.out.print(ex);
}
game.setGameState(GameState.PLAYING);
}
malo by to sluzit na ulozenie
a v triede history ulozenie array listu do suboru
public void save(String path) throws IOException{
String subor = path.trim();
if (subor.length() == 0) { subor = "save.txt"; }
File aFile = new File(subor);
aFile.createNewFile();
try {
LibraryMethods.save((ArrayList<String>) this.historyZoznam, subor);
} catch (Exception ex) {
System.out.println(ex.getMessage());
}
System.out.println("Game Saved !!");
}