EscMenu.java 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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("Retry", (gamestate, level) ->
  28. {
  29. level.reset();
  30. gamestate.setState(Gamestates.GAMEPLAY);
  31. }),
  32. new MenuButton("Main Menu", (gamestate) ->
  33. {
  34. setReturnId(mainId);
  35. }),
  36. new MenuButton("Exit", (gamestate) ->
  37. {
  38. Engine.stop();
  39. }),
  40. };
  41. }
  42. /**
  43. * Returns the options of the EscapeMenu
  44. *
  45. * @return the options of the EscapeMenu
  46. */
  47. @Override
  48. public MenuButton[] getOptions()
  49. {
  50. return options;
  51. }
  52. }