Merge remote-tracking branch 'origin/master'
commit
e8c16f0625
|
@ -38,6 +38,7 @@ public class FileManager {
|
||||||
o = objectStream.readObject();
|
o = objectStream.readObject();
|
||||||
objectStream.close();
|
objectStream.close();
|
||||||
fileStream.close();
|
fileStream.close();
|
||||||
|
System.out.println("done");
|
||||||
return o;
|
return o;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,6 +5,9 @@ Runs the constructor in GamePanel class
|
||||||
*/
|
*/
|
||||||
import java.awt.*;
|
import java.awt.*;
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
|
import java.nio.file.FileSystemException;
|
||||||
|
import java.nio.file.Files;
|
||||||
|
import java.nio.file.Path;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Arrays;
|
import java.util.Arrays;
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
|
@ -25,16 +28,23 @@ public class GameFrame extends JFrame{
|
||||||
main = new CameraPanel();
|
main = new CameraPanel();
|
||||||
main.setLayout(new CardLayout());
|
main.setLayout(new CardLayout());
|
||||||
try {
|
try {
|
||||||
|
System.out.println("done2");
|
||||||
game = (GamePanel)FileManager.readObjectFromFile("local/game_state.dat", Arrays.asList("Any"));
|
game = (GamePanel)FileManager.readObjectFromFile("local/game_state.dat", Arrays.asList("Any"));
|
||||||
game.gameFrame = main;
|
game.gameFrame = main;
|
||||||
game.isContinue = true;
|
game.isContinue = true;
|
||||||
game.addUserInterface();
|
game.addUserInterface();
|
||||||
game.startThread();
|
|
||||||
} catch (IOException | ClassNotFoundException | ClassCastException | SecurityException e) {
|
} catch (IOException | ClassNotFoundException | ClassCastException | SecurityException e) {
|
||||||
System.out.println(e);
|
System.out.println(e);
|
||||||
game = new GamePanel(main); //run GamePanel constructor
|
game = new GamePanel(main); //run GamePanel constructor
|
||||||
game.startThread();
|
|
||||||
}
|
}
|
||||||
|
// delete saves to prevent unexpected behaviour
|
||||||
|
try {
|
||||||
|
Files.deleteIfExists(Path.of("local/game_state.dat"));
|
||||||
|
Files.deleteIfExists(Path.of("local/temp_state.dat"));
|
||||||
|
} catch (FileSystemException e) {
|
||||||
|
System.out.println(e);
|
||||||
|
}
|
||||||
|
game.startThread();
|
||||||
/*
|
/*
|
||||||
try {
|
try {
|
||||||
// read previously saved controls
|
// read previously saved controls
|
||||||
|
|
Loading…
Reference in New Issue