mirror of
https://github.com/inf112-v20/Fiasko.git
synced 2025-01-31 23:29:36 +01:00
endre til objktet Boolean
This commit is contained in:
parent
48384686fb
commit
ea72a6848a
@ -71,7 +71,7 @@ public class PowerDownScreen extends AbstractScreen {
|
|||||||
stage.draw();
|
stage.draw();
|
||||||
|
|
||||||
if (elapsedTime > 10) {
|
if (elapsedTime > 10) {
|
||||||
sendPowerDownStatus(false);
|
sendPowerDownStatus(Boolean.FALSE);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -24,8 +24,8 @@ public class RoboRallyClient {
|
|||||||
client.start();
|
client.start();
|
||||||
NetworkUtil.registerClasses(client.getKryo());
|
NetworkUtil.registerClasses(client.getKryo());
|
||||||
client.connect(5000, ipAddress, 54555, 54777);
|
client.connect(5000, ipAddress, 54555, 54777);
|
||||||
|
|
||||||
client.addListener(new RoboRallyClientListener(wrapper));
|
client.addListener(new RoboRallyClientListener(wrapper));
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -35,6 +35,9 @@ public class RoboRallyClient {
|
|||||||
*/
|
*/
|
||||||
public void sendElement(Object object) {
|
public void sendElement(Object object) {
|
||||||
try {
|
try {
|
||||||
|
if(!client.isConnected()){
|
||||||
|
client.reconnect();
|
||||||
|
}
|
||||||
client.sendTCP(object);
|
client.sendTCP(object);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
|
@ -39,18 +39,20 @@ class RoboRallyClientListener extends Listener {
|
|||||||
GameStartInfo info = (GameStartInfo) object;
|
GameStartInfo info = (GameStartInfo) object;
|
||||||
wrapper.roboRallyGame = new RoboRallyGame(info.getPlayerList(), info.getBoardName(),
|
wrapper.roboRallyGame = new RoboRallyGame(info.getPlayerList(), info.getBoardName(),
|
||||||
wrapper.server != null, info.getPlayerName(), wrapper.server);
|
wrapper.server != null, info.getPlayerName(), wrapper.server);
|
||||||
} else if (object instanceof ProgrammingCardDeck) {
|
} else if (object instanceof ProgrammingCardDeck) {
|
||||||
wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);
|
wrapper.roboRallyGame.setGameState(GameState.CHOOSING_CARDS);
|
||||||
wrapper.roboRallyGame.setPlayerHand((ProgrammingCardDeck) object);
|
new Thread(() -> wrapper.roboRallyGame.setPlayerHand((ProgrammingCardDeck) object)).start();
|
||||||
} else if (object instanceof ProgamsContainer) {
|
} else if (object instanceof ProgamsContainer) {
|
||||||
try {
|
new Thread(() -> {
|
||||||
|
try {
|
||||||
wrapper.roboRallyGame.receiveAllPrograms((ProgamsContainer) object);
|
wrapper.roboRallyGame.receiveAllPrograms((ProgamsContainer) object);
|
||||||
} catch (InterruptedException e) {
|
} catch (InterruptedException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
} else if (object instanceof PowerDownContainer) {
|
}).start();
|
||||||
wrapper.roboRallyGame.receiveStayInPowerDown((PowerDownContainer) object);
|
} 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
|
* This class is used to contain power down status for all players
|
||||||
*/
|
*/
|
||||||
public class PowerDownContainer {
|
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
|
* Instantiates a new power down container
|
||||||
*
|
*
|
||||||
|
Loading…
x
Reference in New Issue
Block a user