diff --git a/core/assets/options/pause.JPG b/core/assets/options/pause.JPG new file mode 100644 index 0000000000000000000000000000000000000000..6d45e775222e61742842b5e93c3ec15096c0efad Binary files /dev/null and b/core/assets/options/pause.JPG differ diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/OptionButton.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/OptionButton.java index 17edeb6cfb6652677b6f9583ede936951a655cb4..cc615218fdfdd78086e9633194fd58450f137363 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/OptionButton.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Buttons/InGameButtons/OptionButton.java @@ -6,6 +6,7 @@ import com.badlogic.gdx.scenes.scene2d.InputEvent; import com.badlogic.gdx.scenes.scene2d.utils.ClickListener; import com.galaxytrucker.galaxytruckerreloaded.View.Buttons.ImButton; import com.galaxytrucker.galaxytruckerreloaded.View.Screen.MainMenu; +import com.galaxytrucker.galaxytruckerreloaded.View.Screen.PauseMenu; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.OptionUI; import com.galaxytrucker.galaxytruckerreloaded.View.UI.Options.PauseMenuUI; @@ -19,7 +20,7 @@ public class OptionButton extends ImButton{ */ private Sound clickSound; - private OptionUI optionUI; + private PauseMenuUI pauseMenuUI; /** Menu object */ private MainMenu mainMenu; @@ -28,14 +29,14 @@ public class OptionButton extends ImButton{ * Constructor * */ - public OptionButton(float x, float y, float width, float height, OptionUI ui) { + public OptionButton(float x, float y, float width, float height, PauseMenuUI ui) { super(new Texture("escape_options_on.png"), x, y, width, height); this.addListener(new ClickListener() { public void clicked(InputEvent event, float x, float y) { leftClick(); } }); - this.optionUI = ui; + this.pauseMenuUI = ui; } /** @@ -43,7 +44,7 @@ public class OptionButton extends ImButton{ */ public void leftClick() { - optionUI.render(); + pauseMenuUI.openOptions(); } } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java index bf182d1ce6ca95957754edeb12b77ee97fbd4a22..2c03095852e2fd1e05f5668124c136edd11b2854 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/Screen/GamePlay.java @@ -195,8 +195,8 @@ public class GamePlay implements Screen { if(shopUI != null) { shopUI.render(); } else if(eventGUI != null) { eventGUI.render(); } else if(gameOverUI != null) { gameOverUI.render(); } - else if(pauseMenuUI != null) { pauseMenuUI.render(); } else if(optionUI != null) { optionUI.render(); } + else if(pauseMenuUI != null) { pauseMenuUI.render(); } stage.draw(); } @@ -208,8 +208,8 @@ public class GamePlay implements Screen { if(shopUI != null) { shopUI.disposeShopUI(); } if(eventGUI != null) { eventGUI.disposeEventGUI(); } if(gameOverUI != null) { gameOverUI.disposeGameoverUI(); } - if(pauseMenuUI != null) { pauseMenuUI.disposePauseMenuUI(); } if(optionUI != null) { optionUI.disposeOptionsUI(); } + if(pauseMenuUI != null) { pauseMenuUI.disposePauseMenuUI(); } stage.dispose(); } @@ -221,7 +221,6 @@ public class GamePlay implements Screen { if(Gdx.input.isKeyPressed(Input.Keys.ESCAPE)) { System.out.println("Where"); createPauseMenu(); - createOptions(); } if(Gdx.input.isKeyPressed(Input.Keys.P)) { //paused @@ -276,10 +275,10 @@ public class GamePlay implements Screen { } public void createOptions() { - optionUI = new OptionUI(main, stage, this, pauseMenuUI); + optionUI = new OptionUI(main, stage, this); } - public void removeOptions() { + public void deleteOptions() { optionUI = null; } diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionUI.java index 739edaa51dfb3d5055102a4d7d3766ce95124ad7..6d49acc4acae569ed52e7ad226f04d7c95da2cc4 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/OptionUI.java @@ -19,11 +19,6 @@ public class OptionUI { */ private Texture optionsBackgroundTexture; - /** - * continue button - */ - private ContinueButton continueButton; - /** * main menu button */ @@ -33,8 +28,6 @@ public class OptionUI { private GamePlay game; - private OptionButton optionButton; - private float x, y; /** @@ -42,7 +35,7 @@ public class OptionUI { * * @param main - main class */ - public OptionUI(Main main, Stage stage, GamePlay game, PauseMenuUI pauseMenuUI) { + public OptionUI(Main main, Stage stage, GamePlay game) { this.main = main; this.game = game; @@ -51,9 +44,9 @@ public class OptionUI { x = main.WIDTH/2 - optionsBackgroundTexture.getWidth()/2; y = main.HEIGHT/2 - optionsBackgroundTexture.getHeight()/2; - continueButton = new ContinueButton(x+220, y+220, 128, 24, pauseMenuUI); + mainMenuButton = new MainMenuButton(x+220, y+270, 128, 24, main); - stage.addActor(continueButton); + stage.addActor(mainMenuButton); } /** @@ -71,10 +64,8 @@ public class OptionUI { */ public void disposeOptionsUI() { optionsBackgroundTexture.dispose(); - continueButton.remove(); mainMenuButton.remove(); - optionButton.remove(); - game.deletePauseMenu(); + game.deleteOptions(); } /** diff --git a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/PauseMenuUI.java b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/PauseMenuUI.java index 11f0fd5fe884a4a2852561b3f6628981da4c97e0..46a5f82853d5567404081b6336c306a3c8df71a9 100644 --- a/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/PauseMenuUI.java +++ b/core/src/com/galaxytrucker/galaxytruckerreloaded/View/UI/Options/PauseMenuUI.java @@ -50,14 +50,14 @@ public class PauseMenuUI { this.main = main; this.game = game; - optionsBackgroundTexture = new Texture("options/options.png"); + optionsBackgroundTexture = new Texture("options/pause.JPG"); x = main.WIDTH/2 - optionsBackgroundTexture.getWidth()/2; y = main.HEIGHT/2 - optionsBackgroundTexture.getHeight()/2; continueButton = new ContinueButton(x+220, y+220, 128, 24, this); mainMenuButton = new MainMenuButton(x+220, y+270, 128, 24, main); - optionButton = new OptionButton(x+220,y+320,128,24, optionUI); + optionButton = new OptionButton(x+220,y+320,128,24, this); stage.addActor(continueButton); stage.addActor(mainMenuButton); @@ -103,4 +103,11 @@ public class PauseMenuUI { */ public void hideOptionsUI() { } + + public void openOptions () { + continueButton.setVisible(false); + mainMenuButton.setVisible(false); + optionButton.setVisible(false); + game.createOptions(); + } }