fixed some bugs with locked cards

This commit is contained in:
Tobydrama 2020-04-21 16:44:13 +02:00
parent 05a92ff9a0
commit d36ff8192b
3 changed files with 11 additions and 2 deletions

View File

@ -95,9 +95,12 @@ public class CardChoiceScreen extends InputAdapter implements Screen {
List<ProgrammingCard> oldProgram = roboRallyWrapper.roboRallyGame.getProgram();
int lockedCardsInt = 5-maxCards;
List<ProgrammingCard> newProgram = getCards();
for(int i = 5; i>(5-lockedCardsInt);i--){
for(int i = 4; i>(4-lockedCardsInt);i--){
newProgram.add(oldProgram.get(i));
}
System.out.println("fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuasdasdasda234234234: "+newProgram.size());
System.out.println(newProgram);
roboRallyWrapper.roboRallyGame.setProgram(newProgram);
roboRallyWrapper.roboRallyGame.setGameState(GameState.CHOOSING_POWER_DOWN);
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getPowerDownScreen(roboRallyWrapper));

View File

@ -46,6 +46,7 @@ public class LoadingScreen extends AbstractScreen {
if (roboRallyWrapper.roboRallyGame != null) {
GameState gameState = roboRallyWrapper.roboRallyGame.getGameState();
System.out.println(gameState);
if (gameState != GameState.LOADING) {
handleScreenChange(gameState);
}

View File

@ -110,7 +110,9 @@ class RoboRallyServerListener extends Listener {
*/
private void receiveContinuePowerDown(Connection connection, Boolean bool) {
stayInPowerDown.put(connection, bool);
System.out.println("fuuuuuuuuuuuuuuuuu");
if (receivedDataFromAllConnections(stayInPowerDown)) {
System.out.println("fuuuuuuuuuuuuuuuuasdasdasdasdasdasdasdu");
Map<String, Boolean> powerDowns = new HashMap<>();
for (Connection connected : stayInPowerDown.keySet()) {
powerDowns.put(playerNames.get(connected), stayInPowerDown.get(connected));
@ -149,8 +151,11 @@ class RoboRallyServerListener extends Listener {
*/
private <K> boolean receivedDataFromAllConnections(Map<Connection, K> data) {
Set<Connection> connections = clients.keySet();
System.out.println("keys "+data.keySet());
System.out.println(connections);
connections.removeAll(deadPlayers);
return connections.containsAll(data.keySet()) && data.keySet().containsAll(connections);
System.out.println(connections);
return data.keySet().containsAll(connections);
}
@Override