This commit is contained in:
Tobydrama 2020-04-14 12:37:03 +02:00
commit 1b04ed462c

View File

@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.GL20;
import com.badlogic.gdx.graphics.OrthographicCamera; import com.badlogic.gdx.graphics.OrthographicCamera;
import com.badlogic.gdx.utils.viewport.ExtendViewport; import com.badlogic.gdx.utils.viewport.ExtendViewport;
import com.badlogic.gdx.utils.viewport.Viewport; import com.badlogic.gdx.utils.viewport.Viewport;
import inf112.fiasko.roborally.element_properties.GameState;
import inf112.fiasko.roborally.game_wrapper.RoboRallyWrapper; import inf112.fiasko.roborally.game_wrapper.RoboRallyWrapper;
/** /**
@ -18,6 +19,8 @@ public class LoadingScreen extends AbstractScreen {
private long startTime; private long startTime;
private GameState initialGameState;
/** /**
* Instantiates a new loading screen * Instantiates a new loading screen
* @param roboRallyWrapper The Robo Rally wrapper which is parent of this screen * @param roboRallyWrapper The Robo Rally wrapper which is parent of this screen
@ -44,19 +47,24 @@ 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 (time - startTime > 5000){ if (roboRallyWrapper.roboRallyGame.getGameState() != initialGameState) {
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper)); handleScreenChange();
} }
} }
private void handleScreenChange() {
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
}
@Override @Override
public void resize(int width, int height) { public void resize(int width, int height) {
viewport.update(width, height); viewport.update(width, height);
} }
@Override @Override
public void show(){ public void show() {
startTime = System.currentTimeMillis(); startTime = System.currentTimeMillis();
initialGameState = roboRallyWrapper.roboRallyGame.getGameState();
} }
} }