endre til et annet screen

This commit is contained in:
Tobydrama 2020-04-14 14:50:45 +02:00
parent 0ddf309e70
commit cafde5245d

View File

@ -47,13 +47,17 @@ public class LoadingScreen extends AbstractScreen {
roboRallyWrapper.batch.end(); roboRallyWrapper.batch.end();
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
//TODO: Allow to set any condition and next screen //TODO: Allow to set any condition and next screen
if (roboRallyWrapper.roboRallyGame.getGameState() != initialGameState) { if (roboRallyWrapper.roboRallyGame != null && roboRallyWrapper.roboRallyGame.getGameState() != initialGameState ) {
handleScreenChange(); handleScreenChange();
} }
} }
private void handleScreenChange() { private void handleScreenChange() {
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper)); switch (initialGameState) {
case SENDING_CARDS:
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
break;
}
} }
@Override @Override
@ -64,7 +68,12 @@ public class LoadingScreen extends AbstractScreen {
@Override @Override
public void show() { public void show() {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
initialGameState = roboRallyWrapper.roboRallyGame.getGameState(); if (roboRallyWrapper.roboRallyGame == null){
initialGameState = GameState.INITIAL_SETUP;
}
else {
initialGameState = roboRallyWrapper.roboRallyGame.getGameState();
}
} }
} }