EscMenu.java 1.1 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. package pathgame.gameplay.menu;
  2. import me.hammerle.snuviengine.api.Engine;
  3. import pathgame.gameplay.Gamestates;
  4. /**
  5. * A container for holding all options of the EscapeMenu
  6. *
  7. * @author julia
  8. */
  9. public class EscMenu extends BaseMenu
  10. {
  11. private final MenuButton[] options;
  12. /**
  13. * Contructor generating and initializing the EscapeMenu
  14. *
  15. * @param id the id of the EscapeMenu
  16. * @param mainId the id to the MainMenu
  17. */
  18. public EscMenu(int id, int mainId)
  19. {
  20. super(id);
  21. options = new MenuButton[]
  22. {
  23. new MenuButton("Continue", (gamestate) ->
  24. {
  25. gamestate.setState(Gamestates.GAMEPLAY);
  26. }),
  27. new MenuButton("Main Menu", (gamestate) ->
  28. {
  29. setReturnId(mainId);
  30. }),
  31. new MenuButton("Exit", (gamestate) ->
  32. {
  33. Engine.stop();
  34. }),
  35. };
  36. }
  37. /**
  38. * Returns the options of the EscapeMenu
  39. *
  40. * @return the options of the EscapeMenu
  41. */
  42. @Override
  43. public MenuButton[] getOptions()
  44. {
  45. return options;
  46. }
  47. }