fixed continue powerdown bugs closes #66

This commit is contained in:
Tobydrama
2020-04-21 14:04:45 +02:00
parent 17a3d4f27a
commit ee18396d3e
6 changed files with 48 additions and 8 deletions

View File

@@ -7,6 +7,9 @@ import com.badlogic.gdx.utils.viewport.ExtendViewport;
import com.badlogic.gdx.utils.viewport.Viewport;
import inf112.fiasko.roborally.elementproperties.GameState;
import inf112.fiasko.roborally.gamewrapper.RoboRallyWrapper;
import inf112.fiasko.roborally.networking.containers.ProgramAndPowerdownRequest;
import java.util.ArrayList;
/**
* This screen is used to wait for something
@@ -68,6 +71,14 @@ public class LoadingScreen extends AbstractScreen {
case EXITED:
roboRallyWrapper.quit("All players died. Cannot continue playing.");
break;
case CHOOSING_POWER_DOWN:
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getPowerDownScreen(this.roboRallyWrapper));
break;
case SKIP_POWER_DOWN_SCREEN:
roboRallyWrapper.roboRallyGame.setGameState(GameState.LOADING);
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(this.roboRallyWrapper));
roboRallyWrapper.client.sendElement(new ProgramAndPowerdownRequest(false, new ArrayList<>()));
break;
default:
System.out.println("The loading screen doesn't know what to do with " + gameState);
break;

View File

@@ -57,11 +57,18 @@ public class PowerDownScreen extends AbstractScreen {
Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
camera.update();
roboRallyWrapper.batch.setProjectionMatrix(camera.combined);
String descriptiontext;
if(roboRallyWrapper.roboRallyGame.getGameState()==GameState.CHOOSING_POWER_DOWN){
descriptiontext = "click the button to enter powerdown next round";
}
else{
descriptiontext = "continue powerdown?";
}
int elapsedTime = (int) Math.floor((System.currentTimeMillis() - startTime) / 1000f);
roboRallyWrapper.batch.begin();
roboRallyWrapper.font.draw(roboRallyWrapper.batch, "Click the button to enter Power Down next round",
roboRallyWrapper.font.draw(roboRallyWrapper.batch, descriptiontext,
applicationWidth / 2f - 380 / 2f, applicationHeight / 2f + 100, 380, 1,
true);
roboRallyWrapper.font.draw(roboRallyWrapper.batch, String.valueOf(10 - elapsedTime),