DEADSOFTWARE

New saving fromat and rewrite in kotlin
[cavedroid.git] / core / src / ru / deadsoftware / cavedroid / menu / submenus / MenuNewGame.java
1 package ru.deadsoftware.cavedroid.menu.submenus;
3 import ru.deadsoftware.cavedroid.MainConfig;
4 import ru.deadsoftware.cavedroid.menu.MenuProc;
5 import ru.deadsoftware.cavedroid.menu.objects.ButtonEventListener;
6 import ru.deadsoftware.cavedroid.menu.objects.ButtonRenderer;
7 import ru.deadsoftware.cavedroid.misc.utils.AssetLoader;
9 import javax.inject.Inject;
10 import java.util.HashMap;
12 public class MenuNewGame extends Menu {
14 public MenuNewGame(float width,
15 float height,
16 ButtonRenderer buttonRenderer,
17 MainConfig mainConfig,
18 MenuProc.Input menuInput,
19 AssetLoader assetLoader) {
20 super(width, height, buttonRenderer, mainConfig, menuInput, assetLoader);
21 }
23 @Override
24 protected HashMap<String, ButtonEventListener> getButtonEventListeners() {
25 HashMap<String, ButtonEventListener> map = new HashMap<>();
26 map.put("survival", mMenuInput::survivalClicked);
27 map.put("creative", mMenuInput::creativeClicked);
28 map.put("back", mMenuInput::backClicked);
29 return map;
30 }
32 @Override
33 protected void initButtons() {
34 loadButtonsFromJson(mAssetLoader.getAssetHandle("json/menu_new_game_buttons.json"));
35 }
37 public static class Factory {
39 private final MainConfig mMainConfig;
40 private final AssetLoader mAssetLoader;
42 @Inject
43 public Factory(MainConfig mainConfig, AssetLoader assetLoader) {
44 mMainConfig = mainConfig;
45 mAssetLoader = assetLoader;
46 }
48 public MenuNewGame get(float width, float height, ButtonRenderer buttonRenderer, MenuProc.Input menuInput) {
49 return new MenuNewGame(width, height, buttonRenderer, mMainConfig, menuInput, mAssetLoader);
50 }
52 }
53 }