mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
fixed some bugs with locked cards
This commit is contained in:
parent
05a92ff9a0
commit
d36ff8192b
@ -95,9 +95,12 @@ public class CardChoiceScreen extends InputAdapter implements Screen {
|
|||||||
List<ProgrammingCard> oldProgram = roboRallyWrapper.roboRallyGame.getProgram();
|
List<ProgrammingCard> oldProgram = roboRallyWrapper.roboRallyGame.getProgram();
|
||||||
int lockedCardsInt = 5-maxCards;
|
int lockedCardsInt = 5-maxCards;
|
||||||
List<ProgrammingCard> newProgram = getCards();
|
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));
|
newProgram.add(oldProgram.get(i));
|
||||||
}
|
}
|
||||||
|
System.out.println("fuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuasdasdasda234234234: "+newProgram.size());
|
||||||
|
System.out.println(newProgram);
|
||||||
|
|
||||||
roboRallyWrapper.roboRallyGame.setProgram(newProgram);
|
roboRallyWrapper.roboRallyGame.setProgram(newProgram);
|
||||||
roboRallyWrapper.roboRallyGame.setGameState(GameState.CHOOSING_POWER_DOWN);
|
roboRallyWrapper.roboRallyGame.setGameState(GameState.CHOOSING_POWER_DOWN);
|
||||||
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getPowerDownScreen(roboRallyWrapper));
|
roboRallyWrapper.setScreen(roboRallyWrapper.screenManager.getPowerDownScreen(roboRallyWrapper));
|
||||||
|
@ -46,6 +46,7 @@ public class LoadingScreen extends AbstractScreen {
|
|||||||
|
|
||||||
if (roboRallyWrapper.roboRallyGame != null) {
|
if (roboRallyWrapper.roboRallyGame != null) {
|
||||||
GameState gameState = roboRallyWrapper.roboRallyGame.getGameState();
|
GameState gameState = roboRallyWrapper.roboRallyGame.getGameState();
|
||||||
|
System.out.println(gameState);
|
||||||
if (gameState != GameState.LOADING) {
|
if (gameState != GameState.LOADING) {
|
||||||
handleScreenChange(gameState);
|
handleScreenChange(gameState);
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,9 @@ class RoboRallyServerListener extends Listener {
|
|||||||
*/
|
*/
|
||||||
private void receiveContinuePowerDown(Connection connection, Boolean bool) {
|
private void receiveContinuePowerDown(Connection connection, Boolean bool) {
|
||||||
stayInPowerDown.put(connection, bool);
|
stayInPowerDown.put(connection, bool);
|
||||||
|
System.out.println("fuuuuuuuuuuuuuuuuu");
|
||||||
if (receivedDataFromAllConnections(stayInPowerDown)) {
|
if (receivedDataFromAllConnections(stayInPowerDown)) {
|
||||||
|
System.out.println("fuuuuuuuuuuuuuuuuasdasdasdasdasdasdasdu");
|
||||||
Map<String, Boolean> powerDowns = new HashMap<>();
|
Map<String, Boolean> powerDowns = new HashMap<>();
|
||||||
for (Connection connected : stayInPowerDown.keySet()) {
|
for (Connection connected : stayInPowerDown.keySet()) {
|
||||||
powerDowns.put(playerNames.get(connected), stayInPowerDown.get(connected));
|
powerDowns.put(playerNames.get(connected), stayInPowerDown.get(connected));
|
||||||
@ -149,8 +151,11 @@ class RoboRallyServerListener extends Listener {
|
|||||||
*/
|
*/
|
||||||
private <K> boolean receivedDataFromAllConnections(Map<Connection, K> data) {
|
private <K> boolean receivedDataFromAllConnections(Map<Connection, K> data) {
|
||||||
Set<Connection> connections = clients.keySet();
|
Set<Connection> connections = clients.keySet();
|
||||||
|
System.out.println("keys "+data.keySet());
|
||||||
|
System.out.println(connections);
|
||||||
connections.removeAll(deadPlayers);
|
connections.removeAll(deadPlayers);
|
||||||
return connections.containsAll(data.keySet()) && data.keySet().containsAll(connections);
|
System.out.println(connections);
|
||||||
|
return data.keySet().containsAll(connections);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
x
Reference in New Issue
Block a user