mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-02-07 18:49:34 +01:00
la til mulighet for manuell tester
This commit is contained in:
parent
4baba2b33a
commit
ae1f29cb34
@ -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();
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user