la til flere cases og endret hvilket screens som blir vist

This commit is contained in:
Tobydrama 2020-04-16 14:59:20 +02:00
parent 198a21a5a4
commit c552ef028b

View File

@ -43,19 +43,26 @@ public class LoadingScreen extends AbstractScreen {
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Loading...", applicationWidth/2f-380/2f, roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Loading...", applicationWidth/2f-380/2f,
applicationHeight / 2f,380, 1, true); applicationHeight / 2f,380, 1, true);
roboRallyWrapper.batch.end(); roboRallyWrapper.batch.end();
long time = System.currentTimeMillis();
//TODO: Allow to set any condition and next screen //if (roboRallyWrapper.roboRallyGame != null){
if (roboRallyWrapper.roboRallyGame != null && roboRallyWrapper.roboRallyGame.getGameState() != initialGameState) { // System.out.println(roboRallyWrapper.roboRallyGame.getGameState());
//}
if (roboRallyWrapper.roboRallyGame != null && roboRallyWrapper.roboRallyGame.getGameState() != GameState.LOADING) {
handleScreenChange(); handleScreenChange();
} }
} }
private void handleScreenChange() { private void handleScreenChange() {
switch (initialGameState) { switch (roboRallyWrapper.roboRallyGame.getGameState()) {
case SENDING_CARDS: case RUNNING_PROGRAMS:
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper)); roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
break; break;
} case INITIAL_SETUP:
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(this.roboRallyWrapper));
break;
case CHOOSING_CARDS:
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getCardChoiceScreen(this.roboRallyWrapper));
break; }
} }
@Override @Override