diff options
author | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-10 14:17:20 +0200 |
---|---|---|
committer | Jérémy Zurcher <jeremy@asynk.ch> | 2016-05-10 14:17:20 +0200 |
commit | 07415f01199e0416935dab6136f568c13e896bec (patch) | |
tree | 0bc42d87daad117ce49492f77d39c30b939441f0 /core | |
parent | a9feaf4eab16f38b3f8a8d8e511fd924b4e0fc8f (diff) | |
download | RustAndDust-07415f01199e0416935dab6136f568c13e896bec.zip RustAndDust-07415f01199e0416935dab6136f568c13e896bec.tar.gz |
MenuCtrl,PlayMenu: use ResumeMenu
Diffstat (limited to 'core')
-rw-r--r-- | core/src/ch/asynk/rustanddust/menu/MenuCtrl.java | 4 | ||||
-rw-r--r-- | core/src/ch/asynk/rustanddust/menu/PlayMenu.java | 35 |
2 files changed, 14 insertions, 25 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java index a28b2e7..b6c1b3e 100644 --- a/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java +++ b/core/src/ch/asynk/rustanddust/menu/MenuCtrl.java @@ -18,7 +18,8 @@ public class MenuCtrl implements Disposable, Drawable TUTORIALS(2), PLAY(3), NEW_GAME(4), - NONE(5), + RESUME(5), + NONE(6), OK(64), OKKO(65), BEGIN(66), @@ -53,6 +54,7 @@ public class MenuCtrl implements Disposable, Drawable this.panels[MenuType.TUTORIALS.i] = new TutorialsMenu(game); this.panels[MenuType.PLAY.i] = new PlayMenu(game); this.panels[MenuType.NEW_GAME.i] = new NewGameMenu(game); + this.panels[MenuType.RESUME.i] = new ResumeMenu(game); this.okCancel = new OkCancel(game.font, game.bgPatch, game.getUiRegion(game.UI_OK), game.getUiRegion(game.UI_CANCEL)); this.current = MenuType.MAIN; diff --git a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java index 9823db0..7e93325 100644 --- a/core/src/ch/asynk/rustanddust/menu/PlayMenu.java +++ b/core/src/ch/asynk/rustanddust/menu/PlayMenu.java @@ -10,7 +10,6 @@ import ch.asynk.rustanddust.ui.List; import ch.asynk.rustanddust.ui.Patch; import ch.asynk.rustanddust.ui.Scrollable; import ch.asynk.rustanddust.RustAndDust; -import ch.asynk.rustanddust.game.Config; import ch.asynk.rustanddust.util.GameRecord; public class PlayMenu extends Patch implements MenuCtrl.Panel @@ -24,9 +23,8 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel private Scrollable list; protected Bg cancelBtn; protected Button newBtn; - protected Button resumeBtn; + protected Button playBtn; protected Button deleteBtn; - protected Button replayBtn; public PlayMenu(RustAndDust game) { @@ -34,9 +32,8 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel this.game = game; this.cancelBtn = new Bg(game.getUiRegion(game.UI_CANCEL)); this.newBtn = new Button("New", game.font, game.bgPatch, 20f); - this.resumeBtn = new Button("Resume", game.font, game.bgPatch, 20f); + this.playBtn = new Button("Play", game.font, game.bgPatch, 20f); this.deleteBtn = new Button("Delete", game.font, game.bgPatch, 20f); - this.replayBtn = new Button("Replay", game.font, game.bgPatch, 20f); this.title = new Label(game.font); this.title.write("- Play"); this.list = new Scrollable(new List(game, 10f), game.framePatch); @@ -102,9 +99,8 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel setBottomLeft(cancelBtn); setBottomRight(newBtn); - resumeBtn.setPosition(newBtn.getX() - resumeBtn.getWidth() - 5, newBtn.getY()); - replayBtn.setPosition(resumeBtn.getX() - replayBtn.getWidth() - 5, newBtn.getY()); - deleteBtn.setPosition(replayBtn.getX() - deleteBtn.getWidth() - 5, newBtn.getY()); + playBtn.setPosition(newBtn.getX() - playBtn.getWidth() - 5, newBtn.getY()); + deleteBtn.setPosition(playBtn.getX() - deleteBtn.getWidth() - 5, newBtn.getY()); showBtns(false); y += padding; @@ -140,13 +136,9 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel } else if (deleteBtn.hit(x, y)) { game.playType(); return MenuCtrl.MenuType.OKKO; - } else if (resumeBtn.hit(x, y)) { - game.playType(); - return setConfig(Config.LoadMode.RESUME); - } else if (replayBtn.hit(x, y)) { - game.playType(); - // TODO chose between : REPLAY_LAST / REPLAY_BATTLE - return setConfig(Config.LoadMode.REPLAY_LAST); + } else if (playBtn.hit(x, y)) { + setConfig(); + return MenuCtrl.MenuType.RESUME; } else if (list.hit(x, y)) { if (i != getList().getIdx()) game.playType(); @@ -157,20 +149,17 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel return MenuCtrl.MenuType.NONE; } - private MenuCtrl.MenuType setConfig(Config.LoadMode loadMode) + private void setConfig() { GameRecord g = GameRecord.get(getList().getIdx()); game.config.gameId = g.id; game.config.battle = game.factory.getBattle(g.battle); - game.config.loadMode = loadMode; - return MenuCtrl.MenuType.BEGIN; } private void showBtns(boolean show) { deleteBtn.visible = show; - resumeBtn.visible = show; - replayBtn.visible = show; + playBtn.visible = show; } @Override @@ -180,10 +169,9 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel list.dispose(); title.dispose(); newBtn.dispose(); - resumeBtn.dispose(); + playBtn.dispose(); deleteBtn.dispose(); cancelBtn.dispose(); - replayBtn.dispose(); GameRecord.clearList(); } @@ -194,9 +182,8 @@ public class PlayMenu extends Patch implements MenuCtrl.Panel list.draw(batch); title.draw(batch); newBtn.draw(batch); - resumeBtn.draw(batch); + playBtn.draw(batch); deleteBtn.draw(batch); cancelBtn.draw(batch); - replayBtn.draw(batch); } } |