mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Merge branch 'master' of https://github.com/inf112-v20/Fiasko
This commit is contained in:
commit
1b04ed462c
@ -5,6 +5,7 @@ import com.badlogic.gdx.graphics.GL20;
|
||||
import com.badlogic.gdx.graphics.OrthographicCamera;
|
||||
import com.badlogic.gdx.utils.viewport.ExtendViewport;
|
||||
import com.badlogic.gdx.utils.viewport.Viewport;
|
||||
import inf112.fiasko.roborally.element_properties.GameState;
|
||||
import inf112.fiasko.roborally.game_wrapper.RoboRallyWrapper;
|
||||
|
||||
/**
|
||||
@ -18,6 +19,8 @@ public class LoadingScreen extends AbstractScreen {
|
||||
|
||||
private long startTime;
|
||||
|
||||
private GameState initialGameState;
|
||||
|
||||
/**
|
||||
* Instantiates a new loading screen
|
||||
* @param roboRallyWrapper The Robo Rally wrapper which is parent of this screen
|
||||
@ -44,11 +47,15 @@ public class LoadingScreen extends AbstractScreen {
|
||||
roboRallyWrapper.batch.end();
|
||||
long time = System.currentTimeMillis();
|
||||
//TODO: Allow to set any condition and next screen
|
||||
if (time - startTime > 5000){
|
||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
|
||||
if (roboRallyWrapper.roboRallyGame.getGameState() != initialGameState) {
|
||||
handleScreenChange();
|
||||
}
|
||||
}
|
||||
|
||||
private void handleScreenChange() {
|
||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getBoardActiveScreen(this.roboRallyWrapper));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resize(int width, int height) {
|
||||
viewport.update(width, height);
|
||||
@ -57,6 +64,7 @@ public class LoadingScreen extends AbstractScreen {
|
||||
@Override
|
||||
public void show() {
|
||||
startTime = System.currentTimeMillis();
|
||||
initialGameState = roboRallyWrapper.roboRallyGame.getGameState();
|
||||
}
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user