mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
Prøver å vente på at spillet er klart før det får kort
This commit is contained in:
parent
ef1a5e0e46
commit
ee4c15c999
@ -13,6 +13,7 @@ import inf112.fiasko.roborally.objects.ProgrammingCardDeck;
|
||||
import inf112.fiasko.roborally.objects.RoboRallyGame;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
/**
|
||||
* This listener handles all receiving from the server
|
||||
@ -108,6 +109,14 @@ class RoboRallyClientListener extends Listener {
|
||||
* @param newHand The new hand this client can choose from
|
||||
*/
|
||||
private void receiveHand(ProgrammingCardDeck newHand) {
|
||||
new Thread(() -> {
|
||||
while (wrapper.roboRallyGame.getGameState() != GameState.WAITING_FOR_CARDS_FROM_SERVER) {
|
||||
try {
|
||||
TimeUnit.MILLISECONDS.sleep(100);
|
||||
} catch (InterruptedException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
if (newHand.isEmpty()) {
|
||||
wrapper.roboRallyGame.setProgram(new ArrayList<>());
|
||||
if (wrapper.roboRallyGame.getRobotPowerDown()) {
|
||||
@ -119,6 +128,7 @@ class RoboRallyClientListener extends Listener {
|
||||
wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);
|
||||
}
|
||||
wrapper.roboRallyGame.setPlayerHand(newHand);
|
||||
}).start();
|
||||
}
|
||||
|
||||
/**
|
||||
|
Loading…
x
Reference in New Issue
Block a user