|
@@ -11,8 +11,8 @@ public class Menu
|
|
private final static int ESCAPE_ID;
|
|
private final static int ESCAPE_ID;
|
|
private final static int OPTION_ID;
|
|
private final static int OPTION_ID;
|
|
private final static int CHARACTER_ID;
|
|
private final static int CHARACTER_ID;
|
|
- private final static int SCORE_ID;
|
|
|
|
-
|
|
|
|
|
|
+ private final static int AFTER_SCORE_ID;
|
|
|
|
+
|
|
static
|
|
static
|
|
{
|
|
{
|
|
int id = 0;
|
|
int id = 0;
|
|
@@ -20,20 +20,20 @@ public class Menu
|
|
ESCAPE_ID = id++;
|
|
ESCAPE_ID = id++;
|
|
OPTION_ID = id++;
|
|
OPTION_ID = id++;
|
|
CHARACTER_ID = id++;
|
|
CHARACTER_ID = id++;
|
|
- SCORE_ID = id++;
|
|
|
|
|
|
+ AFTER_SCORE_ID = id++;
|
|
}
|
|
}
|
|
-
|
|
|
|
- private final BaseMenu[] menus = new BaseMenu[]
|
|
|
|
- {
|
|
|
|
- new MainMenu(MAIN_ID, OPTION_ID, CHARACTER_ID),
|
|
|
|
- new EscMenu(ESCAPE_ID, MAIN_ID),
|
|
|
|
- new OptionMenu(OPTION_ID, MAIN_ID),
|
|
|
|
|
|
+
|
|
|
|
+ private final BaseMenu[] menus = new BaseMenu[]
|
|
|
|
+ {
|
|
|
|
+ new MainMenu(MAIN_ID, OPTION_ID, CHARACTER_ID),
|
|
|
|
+ new EscMenu(ESCAPE_ID, MAIN_ID),
|
|
|
|
+ new OptionMenu(OPTION_ID, MAIN_ID),
|
|
new CharacterMenu(CHARACTER_ID, MAIN_ID),
|
|
new CharacterMenu(CHARACTER_ID, MAIN_ID),
|
|
- new ScoreMenu(SCORE_ID, MAIN_ID)
|
|
|
|
|
|
+ new AfterScoreMenu(AFTER_SCORE_ID, MAIN_ID)
|
|
};
|
|
};
|
|
-
|
|
|
|
|
|
+
|
|
private int currentIndex = 0;
|
|
private int currentIndex = 0;
|
|
-
|
|
|
|
|
|
+
|
|
public void tick(Gamestate gamestate, Level level)
|
|
public void tick(Gamestate gamestate, Level level)
|
|
{
|
|
{
|
|
if(gamestate.getState() == Gamestates.MENU)
|
|
if(gamestate.getState() == Gamestates.MENU)
|
|
@@ -43,6 +43,11 @@ public class Menu
|
|
{
|
|
{
|
|
gamestate.setState(Gamestates.GAMEPLAY);
|
|
gamestate.setState(Gamestates.GAMEPLAY);
|
|
}
|
|
}
|
|
|
|
+ else if((currentIndex == OPTION_ID || currentIndex == CHARACTER_ID)
|
|
|
|
+ && Keys.ESCAPE_KEY.getTime() == 1)
|
|
|
|
+ {
|
|
|
|
+ currentIndex = MAIN_ID;
|
|
|
|
+ }
|
|
}
|
|
}
|
|
else if(gamestate.getState() == Gamestates.GAMEPLAY && Keys.ESCAPE_KEY.getTime() == 1)
|
|
else if(gamestate.getState() == Gamestates.GAMEPLAY && Keys.ESCAPE_KEY.getTime() == 1)
|
|
{
|
|
{
|
|
@@ -50,29 +55,29 @@ public class Menu
|
|
gamestate.setState(Gamestates.MENU);
|
|
gamestate.setState(Gamestates.MENU);
|
|
menus[currentIndex].resetIndex();
|
|
menus[currentIndex].resetIndex();
|
|
}
|
|
}
|
|
- else if(gamestate.getState() == Gamestates.GAMEPLAY && level.getPlayer().hasWon())
|
|
|
|
|
|
+ else if(level.getShowAfterScore())
|
|
{
|
|
{
|
|
- currentIndex = SCORE_ID;
|
|
|
|
|
|
+ currentIndex = AFTER_SCORE_ID;
|
|
gamestate.setState(Gamestates.MENU);
|
|
gamestate.setState(Gamestates.MENU);
|
|
menus[currentIndex].resetIndex();
|
|
menus[currentIndex].resetIndex();
|
|
}
|
|
}
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public MenuButton[] getOptions()
|
|
public MenuButton[] getOptions()
|
|
{
|
|
{
|
|
return menus[currentIndex].getOptions();
|
|
return menus[currentIndex].getOptions();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public int getActiveIndex()
|
|
public int getActiveIndex()
|
|
{
|
|
{
|
|
return menus[currentIndex].getActiveIndex();
|
|
return menus[currentIndex].getActiveIndex();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public boolean isOptionMenu()
|
|
public boolean isOptionMenu()
|
|
{
|
|
{
|
|
return menus[currentIndex].isOptionMenu();
|
|
return menus[currentIndex].isOptionMenu();
|
|
}
|
|
}
|
|
-
|
|
|
|
|
|
+
|
|
public void showEscapeMenu()
|
|
public void showEscapeMenu()
|
|
{
|
|
{
|
|
currentIndex = ESCAPE_ID;
|
|
currentIndex = ESCAPE_ID;
|