merge the new developmentbranch into the test branch #39

Closed
j23f0712 wants to merge 431 commits from development2 into dev/test
61 changed files with 1831 additions and 704 deletions
Showing only changes of commit c1b4caa82b - Show all commits

View File

@@ -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()) {