mirror of
				https://github.com/inf112-v20/Fiasko.git
				synced 2025-11-03 03:03:43 +01:00 
			
		
		
		
	endre til objktet Boolean
This commit is contained in:
		@@ -71,7 +71,7 @@ public class PowerDownScreen extends AbstractScreen {
 | 
			
		||||
        stage.draw();
 | 
			
		||||
 | 
			
		||||
        if (elapsedTime > 10) {
 | 
			
		||||
            sendPowerDownStatus(false);
 | 
			
		||||
            sendPowerDownStatus(Boolean.FALSE);
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -24,8 +24,8 @@ public class RoboRallyClient {
 | 
			
		||||
        client.start();
 | 
			
		||||
        NetworkUtil.registerClasses(client.getKryo());
 | 
			
		||||
        client.connect(5000, ipAddress, 54555, 54777);
 | 
			
		||||
 | 
			
		||||
        client.addListener(new RoboRallyClientListener(wrapper));
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
@@ -35,6 +35,9 @@ public class RoboRallyClient {
 | 
			
		||||
     */
 | 
			
		||||
    public void sendElement(Object object) {
 | 
			
		||||
        try {
 | 
			
		||||
            if(!client.isConnected()){
 | 
			
		||||
                client.reconnect();
 | 
			
		||||
            }
 | 
			
		||||
            client.sendTCP(object);
 | 
			
		||||
        } catch (Exception e) {
 | 
			
		||||
            e.printStackTrace();
 | 
			
		||||
 
 | 
			
		||||
@@ -39,18 +39,20 @@ class RoboRallyClientListener extends Listener {
 | 
			
		||||
            GameStartInfo info = (GameStartInfo) object;
 | 
			
		||||
            wrapper.roboRallyGame = new RoboRallyGame(info.getPlayerList(), info.getBoardName(),
 | 
			
		||||
                    wrapper.server != null, info.getPlayerName(), wrapper.server);
 | 
			
		||||
        } else if (object instanceof ProgrammingCardDeck) {
 | 
			
		||||
            wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);
 | 
			
		||||
            wrapper.roboRallyGame.setPlayerHand((ProgrammingCardDeck) object);
 | 
			
		||||
        }  else if (object instanceof ProgrammingCardDeck) {
 | 
			
		||||
             wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);
 | 
			
		||||
             new Thread(() -> wrapper.roboRallyGame.setPlayerHand((ProgrammingCardDeck) object)).start();
 | 
			
		||||
        } else if (object instanceof ProgamsContainer) {
 | 
			
		||||
            try {
 | 
			
		||||
            new Thread(() -> {
 | 
			
		||||
                try {
 | 
			
		||||
                wrapper.roboRallyGame.receiveAllPrograms((ProgamsContainer) object);
 | 
			
		||||
            } catch (InterruptedException e) {
 | 
			
		||||
                e.printStackTrace();
 | 
			
		||||
            }
 | 
			
		||||
        } else if (object instanceof PowerDownContainer) {
 | 
			
		||||
            wrapper.roboRallyGame.receiveStayInPowerDown((PowerDownContainer) object);
 | 
			
		||||
        }
 | 
			
		||||
                     } catch (InterruptedException e) {
 | 
			
		||||
                          e.printStackTrace();
 | 
			
		||||
                     }
 | 
			
		||||
             }).start();
 | 
			
		||||
         } else if (object instanceof PowerDownContainer) {
 | 
			
		||||
            new Thread(() -> wrapper.roboRallyGame.receiveStayInPowerDown((PowerDownContainer) object)).start();
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -6,8 +6,14 @@ import java.util.Map;
 | 
			
		||||
 * This class is used to contain power down status for all players
 | 
			
		||||
 */
 | 
			
		||||
public class PowerDownContainer {
 | 
			
		||||
    private final Map<String, Boolean> powerDown;
 | 
			
		||||
    private Map<String, Boolean> powerDown;
 | 
			
		||||
 | 
			
		||||
    /**
 | 
			
		||||
     * IMPORTANT!!!
 | 
			
		||||
     * DO NOT USE!
 | 
			
		||||
     * Kryonet demands a no args constructor or else it throws a exception
 | 
			
		||||
     */
 | 
			
		||||
    public PowerDownContainer(){}
 | 
			
		||||
    /**
 | 
			
		||||
     * Instantiates a new power down container
 | 
			
		||||
     *
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user