-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathMainMenuController.java
34 lines (29 loc) · 1.1 KB
/
MainMenuController.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
package controller.menu;
import controller.GameController;
import controller.command.game.ExitGameCommand;
import controller.command.controller_state.OpenPopupMenuCommand;
import controller.menu.builder.info.ConfirmationMenuControllerBuilder;
import gui.GUI;
import model.menu.Menu;
import viewer.GameViewer;
import viewer.menu.MainMenuViewer;
public class MainMenuController extends MenuController {
public MainMenuController(Menu menu, GameController gameController) {
super(menu, gameController);
}
@Override
public void reactKeyboard(GUI.KEYBOARD_ACTION action) {
if (action == GUI.KEYBOARD_ACTION.BACK) {
new OpenPopupMenuCommand(this.gameController, new ConfirmationMenuControllerBuilder(this.gameController,
"EXIT GAME", "DO YOU WANT TO EXIT?")
.setYesCommand(new ExitGameCommand(this.gameController))
).execute();
}
}
@Override
public void reactTimePassed(long elapsedTimeSinceLastFrame) {}
@Override
public GameViewer getViewer() {
return new MainMenuViewer(this.getMenu());
}
}