summaryrefslogtreecommitdiffstats
path: root/core/src/ch
diff options
context:
space:
mode:
authorJérémy Zurcher <jeremy@asynk.ch>2016-02-23 18:43:59 +0100
committerJérémy Zurcher <jeremy@asynk.ch>2016-02-23 18:43:59 +0100
commit9362c99503f3cdb9d20fcba63fc83089d468f622 (patch)
tree622a31fbb3ed06593d63e7210377fccdd2de8034 /core/src/ch
parentabb47a87f2f6b2af388c516094b8566a3740a214 (diff)
downloadRustAndDust-9362c99503f3cdb9d20fcba63fc83089d468f622.zip
RustAndDust-9362c99503f3cdb9d20fcba63fc83089d468f622.tar.gz
NewGameMenu: support resume existing game
Diffstat (limited to 'core/src/ch')
-rw-r--r--core/src/ch/asynk/rustanddust/menu/NewGameMenu.java28
1 files changed, 23 insertions, 5 deletions
diff --git a/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java b/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java
index b19dd8b..7abe61f 100644
--- a/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java
+++ b/core/src/ch/asynk/rustanddust/menu/NewGameMenu.java
@@ -27,6 +27,7 @@ public class NewGameMenu extends Patch implements MenuCtrl.Panel
private ObjectivesPanel objectivesPanel;
protected Bg okBtn;
protected Bg cancelBtn;
+ private boolean notImplemented;
public NewGameMenu(RustAndDust game)
{
@@ -72,12 +73,19 @@ public class NewGameMenu extends Patch implements MenuCtrl.Panel
}
@Override
- public MenuCtrl.MenuType postAnswer(boolean ok) { return MenuCtrl.MenuType.NONE; }
+ public MenuCtrl.MenuType postAnswer(boolean ok)
+ {
+ if (ok) return MenuCtrl.MenuType.BEGIN;
+ return MenuCtrl.MenuType.NONE;
+ }
@Override
public String getAsk()
{
- return String.format("'%s' Game Mode not implemented yet.", game.config.gameMode.s);
+ if (notImplemented)
+ return String.format("'%s' Game Mode not implemented yet.", game.config.gameMode.s);
+ else
+ return String.format("Resume '%s' ?", game.config.battle.toString());
}
@Override
@@ -131,7 +139,7 @@ public class NewGameMenu extends Patch implements MenuCtrl.Panel
if (okBtn.hit(x, y)) {
game.playEnter();
- return apply();
+ return tryLaunch();
} else if (cancelBtn.hit(x, y)) {
game.playType();
return MenuCtrl.MenuType.MAIN;
@@ -150,9 +158,19 @@ public class NewGameMenu extends Patch implements MenuCtrl.Panel
return MenuCtrl.MenuType.NONE;
}
- private MenuCtrl.MenuType apply() {
- if (!game.config.gameModeImplemented())
+ private MenuCtrl.MenuType tryLaunch()
+ {
+ if (!game.config.gameModeImplemented()) {
+ notImplemented = true;
return MenuCtrl.MenuType.OK;
+ }
+
+ game.config.gameId = game.db.gameExists(game.config.battle.getId(), game.config.gameMode.i);
+ System.err.println(game.config.gameId);
+ if (game.config.gameId != game.db.NO_RECORD) {
+ notImplemented = false;
+ return MenuCtrl.MenuType.OKKO;
+ }
return MenuCtrl.MenuType.BEGIN;
}