diff --git a/src/main/java/Game.java b/src/main/java/Game.java index 1cc0c9d..63e2c93 100644 --- a/src/main/java/Game.java +++ b/src/main/java/Game.java @@ -4,11 +4,12 @@ import ruscz.game.gameOfProd.Windows.WindowOfMenu; import javax.swing.*; import java.awt.event.KeyAdapter; import java.awt.event.KeyEvent; +import java.awt.event.KeyListener; import java.awt.event.WindowEvent; public class Game extends JFrame { - public static final int WINDOW_WIDTH = 11; - public static final int WINDOW_HEIGHT = 11; + private static final int WINDOW_WIDTH = 11; + private static final int WINDOW_HEIGHT = 11; public static final int CELL_SIZE = 50; private static final int KEY_FULLSCREEN = 115; @@ -26,11 +27,11 @@ public class Game extends JFrame { menu = new WindowOfMenu(this, freeMove); //tohle spustí na začátku menu, ale nejsem schopen přinutit to menu, aby se vzdalo Listeneru a mohl ho využít Game - //add(menu); + add(menu); //tohle spustí na začátku hru, vše funguje tak, jak má - add(freeMove); - freeMove.start(true); +// add(freeMove); +// freeMove.start(true); setDefaultCloseOperation(EXIT_ON_CLOSE); setUndecorated(true); @@ -53,7 +54,6 @@ public class Game extends JFrame { setExtendedState(NORMAL); else setExtendedState(MAXIMIZED_BOTH); - return; } else { diff --git a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java index 73cf445..7ada2b3 100644 --- a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java +++ b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfFreeMove.java @@ -120,7 +120,6 @@ public class WindowOfFreeMove extends JLayeredPane { } public void start(boolean newGame) { - mapLinkedList = new LinkedList<>(); mapManager = new MapManager(mapLinkedList, canvas, this); diff --git a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfMenu.java b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfMenu.java index eb6093c..ed932f3 100644 --- a/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfMenu.java +++ b/src/main/java/ruscz/game/gameOfProd/Windows/WindowOfMenu.java @@ -26,6 +26,7 @@ public class WindowOfMenu extends JLayeredPane { background.setBackground(Color.BLACK); startNewGame = new JButton("START NEW GAME"); + startNewGame.setFocusable(false); startNewGame.setBounds((WINDOW_WIDTH*CELL_SIZE - 200) / 2,(WINDOW_HEIGHT*CELL_SIZE - 30) / 2 -70,200,30); startNewGame.setActionCommand("startNewGame"); startNewGame.addActionListener(new ActionListener() { @@ -33,11 +34,13 @@ public class WindowOfMenu extends JLayeredPane { public void actionPerformed(ActionEvent actionEvent) { cleanUp(); game.add(freeMove); + freeMove.setFocusable(true); freeMove.start(true); } }); loadSavedGame = new JButton("LOAD SAVED GAME"); + loadSavedGame.setFocusable(false); loadSavedGame.setBounds((WINDOW_WIDTH*CELL_SIZE - 200) / 2,(WINDOW_HEIGHT*CELL_SIZE - 30) / 2,200,30); loadSavedGame.setActionCommand("loadSavedGame"); loadSavedGame.addActionListener(new ActionListener() { @@ -45,11 +48,13 @@ public class WindowOfMenu extends JLayeredPane { public void actionPerformed(ActionEvent actionEvent) { cleanUp(); game.add(freeMove); + freeMove.setFocusable(true); freeMove.start(false); } }); exitGame = new JButton("EXIT GAME"); + exitGame.setFocusable(false); exitGame.setBounds((WINDOW_WIDTH*CELL_SIZE - 200) / 2,(WINDOW_HEIGHT*CELL_SIZE - 30) / 2 + 70,200,30); exitGame.setActionCommand("exitGame"); exitGame.addActionListener(new ActionListener() { @@ -68,9 +73,6 @@ public class WindowOfMenu extends JLayeredPane { private void cleanUp() { setVisible(false); game.remove(this); -// startNewGame.removeAll(); -// loadSavedGame.removeAll(); -// exitGame.removeAll(); } public WindowOfMenu menu() { return this; } diff --git a/src/main/resources/save/savedGame/events.txt b/src/main/resources/save/savedGame/events.txt index e69de29..5807f8a 100644 --- a/src/main/resources/save/savedGame/events.txt +++ b/src/main/resources/save/savedGame/events.txt @@ -0,0 +1,50 @@ + + m1 + + + + + m2 + + + 7 + 2 + true + + + + + m3 + + + 2 + 5 + true + + + + + m4 + + + 3 + 3 + true + + + + + m5 + + + + + m6 + + + 11 + 11 + true + + + diff --git a/src/main/resources/save/savedGame/inventory.txt b/src/main/resources/save/savedGame/inventory.txt index e69de29..7082420 100644 --- a/src/main/resources/save/savedGame/inventory.txt +++ b/src/main/resources/save/savedGame/inventory.txt @@ -0,0 +1 @@ +TODO: Inventory \ No newline at end of file diff --git a/src/main/resources/save/savedGame/person.txt b/src/main/resources/save/savedGame/person.txt index e69de29..fd8d8e6 100644 --- a/src/main/resources/save/savedGame/person.txt +++ b/src/main/resources/save/savedGame/person.txt @@ -0,0 +1,5 @@ + + m6 + 11 + 1 + \ No newline at end of file diff --git a/src/main/resources/save/savedGame/village.txt b/src/main/resources/save/savedGame/village.txt index e69de29..1b4bc7b 100644 --- a/src/main/resources/save/savedGame/village.txt +++ b/src/main/resources/save/savedGame/village.txt @@ -0,0 +1 @@ +TODO: Village \ No newline at end of file