merge the new developmentbranch into the test branch #39
@@ -5,12 +5,14 @@
|
||||
import pp.mdga.client.DialogsState;
|
||||
import pp.mdga.game.Color;
|
||||
import pp.mdga.game.Piece;
|
||||
import pp.mdga.game.Player;
|
||||
import pp.mdga.message.client.*;
|
||||
import pp.mdga.message.server.*;
|
||||
import pp.mdga.notification.*;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
public class LobbyState extends DialogStates {
|
||||
@@ -61,9 +63,7 @@ public void selectUnready() {
|
||||
@Override
|
||||
public void selectStart() {
|
||||
if (logic.isHost() && logic.getGame().areAllReady()) {
|
||||
logic.send(new StartGameMessage(false));
|
||||
} else if (logic.isHost() && !logic.getGame().areAllReady()) {
|
||||
logic.send(new StartGameMessage(true));
|
||||
logic.send(new StartGameMessage());
|
||||
} else {
|
||||
LOGGER.log(System.Logger.Level.ERROR, "You are not the host");
|
||||
}
|
||||
@@ -71,6 +71,13 @@ public void selectStart() {
|
||||
|
||||
@Override
|
||||
public void received(ServerStartGameMessage msg) {
|
||||
for (Player player: msg.getPlayers()) {
|
||||
for (Map.Entry<Integer, Player> entry: this.logic.getGame().getPlayers().entrySet()) {
|
||||
if (entry.getValue().getColor() == player.getColor()) {
|
||||
this.logic.getGame().getPlayers().put(entry.getKey(), player);
|
||||
}
|
||||
}
|
||||
}
|
||||
logic.getGame().setBoard(msg.getBoard());
|
||||
logic.addNotification(new GameNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor()));
|
||||
for (var player : logic.getGame().getPlayers().values()) {
|
||||
|
||||
Reference in New Issue
Block a user