mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-11-04 11:43:44 +01:00 
			
		
		
		
	la til mulighet for manuell tester
This commit is contained in:
		@@ -41,4 +41,6 @@ public interface RoboRallyUI {
 | 
			
		||||
     * @param shouldHurry True if the user should hurry
 | 
			
		||||
     */
 | 
			
		||||
    void setShouldHurry(boolean shouldHurry);
 | 
			
		||||
 | 
			
		||||
    boolean isTesting();
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -20,6 +20,7 @@ public class RoboRallyWrapper extends Game implements RoboRallyUI {
 | 
			
		||||
    public RoboRallyServer server;
 | 
			
		||||
    public RoboRallyClient client;
 | 
			
		||||
    public boolean shouldHurry = false;
 | 
			
		||||
    public boolean isTesting = false;
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public void create() {
 | 
			
		||||
@@ -71,4 +72,9 @@ public class RoboRallyWrapper extends Game implements RoboRallyUI {
 | 
			
		||||
    public void quit() {
 | 
			
		||||
        Gdx.app.exit();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    @Override
 | 
			
		||||
    public boolean isTesting(){
 | 
			
		||||
        return this.isTesting;
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -59,21 +59,23 @@ public class LobbyScreen extends InteractiveScreen {
 | 
			
		||||
 | 
			
		||||
            @Override
 | 
			
		||||
            public void touchUp(InputEvent event, float x, float y, int pointer, int button) {
 | 
			
		||||
                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));
 | 
			
		||||
                startGame();
 | 
			
		||||
            }
 | 
			
		||||
        });
 | 
			
		||||
        Gdx.input.setInputProcessor(stage);
 | 
			
		||||
        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
 | 
			
		||||
    public void show() {
 | 
			
		||||
        super.show();
 | 
			
		||||
@@ -92,6 +94,13 @@ public class LobbyScreen extends InteractiveScreen {
 | 
			
		||||
            }
 | 
			
		||||
            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;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user