Skip to content
Snippets Groups Projects
Commit 0f90614f authored by Sixten Müller's avatar Sixten Müller
Browse files

feat: added ifAllPlayersFinished check

parent 286a54e3
No related branches found
No related tags found
2 merge requests!22Resolve "Create game model",!18Draft: Resolve "Create game model"
...@@ -101,9 +101,11 @@ public class LeaderBoardController { ...@@ -101,9 +101,11 @@ public class LeaderBoardController {
mouseYCoordinate =Gdx.input.getY(); mouseYCoordinate =Gdx.input.getY();
Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0); Vector3 touchPos = new Vector3(Gdx.input.getX(), Gdx.input.getY(), 0);
state.getCam().unproject(touchPos); // convert from screen coordinates to world coordinates state.getCam().unproject(touchPos); // convert from screen coordinates to world coordinates
if(leaderBoardView.isHost()) {
if (leaderBoardView.getNextRoundBounds().contains(touchPos.x, touchPos.y)) { if (leaderBoardView.getNextRoundBounds().contains(touchPos.x, touchPos.y)) {
state.getStateManager().setState(new GamePlayState(state.getStateManager(), _FBIC, pin, nickname)); state.getStateManager().setState(new GamePlayState(state.getStateManager(), _FBIC, pin, nickname));
} }
}
} }
......
...@@ -107,7 +107,7 @@ public class WaitingLobbyController { ...@@ -107,7 +107,7 @@ public class WaitingLobbyController {
timer += dt; timer += dt;
if (scoreUpdated) { if (scoreUpdated) {
boolean allPlayersFinished = _FBIC.checkIfAllPlayersAreFinished(pin); boolean allPlayersFinished = _FBIC.checkIfAllPlayersAreFinished(pin);
if (timer >= 10 && round < 3 ) { // This means 4 rounds, starting from 0 if (timer >= 10 && round < 3 && allPlayersFinished) { // This means 4 rounds, starting from 0
Gdx.app.postRunnable(() -> { Gdx.app.postRunnable(() -> {
state.getStateManager().setState(new LeaderBoardState(state.getStateManager(), _FBIC, pin, nickname)); state.getStateManager().setState(new LeaderBoardState(state.getStateManager(), _FBIC, pin, nickname));
}); });
......
...@@ -128,18 +128,6 @@ public class LeaderBoardView { ...@@ -128,18 +128,6 @@ public class LeaderBoardView {
place++; place++;
} }
} }
/*spriteBatch.draw(pinkBubble,45,490,400,100);
spriteBatch.draw(firstPlaceTex,80,520,35,35);
playerFont.draw(spriteBatch,"Marcus",120,560);
spriteBatch.draw(goldenBubble,45,410,400,100);
spriteBatch.draw(secondPlaceTex,80,440,35,35);
playerFont.draw(spriteBatch,"Askh",120,480);
*/
spriteBatch.end(); spriteBatch.end();
} }
...@@ -160,6 +148,10 @@ public class LeaderBoardView { ...@@ -160,6 +148,10 @@ public class LeaderBoardView {
isHost = host; isHost = host;
} }
public boolean isHost() {
return isHost;
}
public OrthographicCamera getCam() { public OrthographicCamera getCam() {
return cam; return cam;
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment