la til mulighet for manuell tester

This commit is contained in:
Tobydrama 2020-05-03 15:10:02 +02:00
parent 4baba2b33a
commit ae1f29cb34
3 changed files with 27 additions and 10 deletions

View File

@ -41,4 +41,6 @@ public interface RoboRallyUI {
* @param shouldHurry True if the user should hurry * @param shouldHurry True if the user should hurry
*/ */
void setShouldHurry(boolean shouldHurry); void setShouldHurry(boolean shouldHurry);
boolean isTesting();
} }

View File

@ -20,6 +20,7 @@ public class RoboRallyWrapper extends Game implements RoboRallyUI {
public RoboRallyServer server; public RoboRallyServer server;
public RoboRallyClient client; public RoboRallyClient client;
public boolean shouldHurry = false; public boolean shouldHurry = false;
public boolean isTesting = false;
@Override @Override
public void create() { public void create() {
@ -71,4 +72,9 @@ public class RoboRallyWrapper extends Game implements RoboRallyUI {
public void quit() { public void quit() {
Gdx.app.exit(); Gdx.app.exit();
} }
@Override
public boolean isTesting(){
return this.isTesting;
}
} }

View File

@ -59,21 +59,23 @@ public class LobbyScreen extends InteractiveScreen {
@Override @Override
public void touchUp(InputEvent event, float x, float y, int pointer, int button) { public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
roboRallyWrapper.server.startGame(); startGame();
Map<Connection, String> playerNames = roboRallyWrapper.server.getPlayerNames();
List<Player> playerList = IOUtil.playerGenerator(playerNames,
roboRallyWrapper.server.getRobotID());
for (Connection connection : playerNames.keySet()) {
roboRallyWrapper.server.sendToClient(connection, new GameStartInfoResponse(
selectBox.getSelected() + ".txt", playerList, playerNames.get(connection)));
}
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(roboRallyWrapper));
} }
}); });
Gdx.input.setInputProcessor(stage); Gdx.input.setInputProcessor(stage);
stage.setViewport(viewport); stage.setViewport(viewport);
} }
private void startGame(){
roboRallyWrapper.server.startGame();
Map<Connection, String> playerNames = roboRallyWrapper.server.getPlayerNames();
List<Player> playerList = IOUtil.playerGenerator(playerNames,
roboRallyWrapper.server.getRobotID());
for (Connection connection : playerNames.keySet()) {
roboRallyWrapper.server.sendToClient(connection, new GameStartInfoResponse(
selectBox.getSelected() + ".txt", playerList, playerNames.get(connection)));
}
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getLoadingScreen(roboRallyWrapper));
}
@Override @Override
public void show() { public void show() {
super.show(); super.show();
@ -92,6 +94,13 @@ public class LobbyScreen extends InteractiveScreen {
} }
return true; return true;
} }
else if(keyCode == Input.Keys.T){
roboRallyWrapper.isTesting=true;
String testBoard = "Manuall_testing";
selectBox.getItems().add(testBoard);
selectBox.setSelected(testBoard);
startGame();
}
return false; return false;
} }