10db012c8efe278812fd3765f8e9be47acc0a7fe
1 package ru
.deadsoftware
.cavedroid
.menu
.submenus
;
3 import com
.badlogic
.gdx
.Gdx
;
4 import ru
.deadsoftware
.cavedroid
.game
.GameSaver
;
5 import ru
.deadsoftware
.cavedroid
.menu
.objects
.Button
;
6 import ru
.deadsoftware
.cavedroid
.menu
.objects
.ButtonEventListener
;
7 import ru
.deadsoftware
.cavedroid
.menu
.objects
.ButtonRenderer
;
9 import java
.util
.HashMap
;
11 public class MenuMain
extends Menu
{
13 public MenuMain(float width
, float height
, ButtonRenderer buttonRenderer
) {
14 super(width
, height
, buttonRenderer
);
18 protected HashMap
<String
, ButtonEventListener
> getButtonEventListeners() {
19 HashMap
<String
, ButtonEventListener
> map
= new HashMap
<>();
20 map
.put("new_game", MenuInput
::newGameClicked
);
21 map
.put("load_game", MenuInput
::loadGameClicked
);
22 map
.put("quit", MenuInput
::quitClicked
);
27 protected void initButtons() {
28 loadButtonsFromJson(Gdx
.files
.internal("json/menu_main_buttons.json"));
29 if (GameSaver
.exists()) {
30 getButtons().get("load_game").setType(Button
.NORMAL
);