added the playeringamenotification to be created from the right dataset
This commit is contained in:
@@ -3,8 +3,10 @@
|
|||||||
import pp.mdga.client.gameState.*;
|
import pp.mdga.client.gameState.*;
|
||||||
import pp.mdga.game.BonusCard;
|
import pp.mdga.game.BonusCard;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
|
import pp.mdga.message.client.LeaveGameMessage;
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.notification.InterruptNotification;
|
import pp.mdga.notification.InterruptNotification;
|
||||||
|
import pp.mdga.notification.StartDialogNotification;
|
||||||
|
|
||||||
public class GameState extends ClientState {
|
public class GameState extends ClientState {
|
||||||
|
|
||||||
@@ -105,6 +107,13 @@ public void received(PauseGameMessage msg){
|
|||||||
logic.addNotification(new InterruptNotification(logic.getGame().getPlayers().get(msg.getPlayerId()).getColor()));
|
logic.addNotification(new InterruptNotification(logic.getGame().getPlayers().get(msg.getPlayerId()).getColor()));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void selectLeave(){
|
||||||
|
logic.send(new LeaveGameMessage());
|
||||||
|
logic.addNotification(new StartDialogNotification());
|
||||||
|
logic.setState(logic.getDialogs());
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This method is used to call the received method of the current state
|
* This method is used to call the received method of the current state
|
||||||
*
|
*
|
||||||
|
|||||||
@@ -5,6 +5,7 @@
|
|||||||
import pp.mdga.client.DialogsState;
|
import pp.mdga.client.DialogsState;
|
||||||
import pp.mdga.game.Color;
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.game.Piece;
|
import pp.mdga.game.Piece;
|
||||||
|
import pp.mdga.game.Player;
|
||||||
import pp.mdga.game.PlayerData;
|
import pp.mdga.game.PlayerData;
|
||||||
import pp.mdga.message.client.*;
|
import pp.mdga.message.client.*;
|
||||||
import pp.mdga.message.server.LobbyPlayerJoinedMessage;
|
import pp.mdga.message.server.LobbyPlayerJoinedMessage;
|
||||||
@@ -74,14 +75,15 @@ public void selectStart(){
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(ServerStartGameMessage msg){
|
public void received(ServerStartGameMessage msg){
|
||||||
|
logic.getGame().setBoard(msg.getBoard());
|
||||||
logic.addNotification(new GameNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor()));
|
logic.addNotification(new GameNotification(logic.getGame().getPlayerById(logic.getOwnPlayerId()).getColor()));
|
||||||
for (Map.Entry<Color, PlayerData> entry : logic.getGame().getBoard().getPlayerData().entrySet()) {
|
for (Map.Entry<Integer, Player> entry : logic.getGame().getPlayers().entrySet()) {
|
||||||
List<UUID> pieceList = new ArrayList<>();
|
entry.getValue().initialize();
|
||||||
|
List<UUID> pieces = new ArrayList<>();
|
||||||
for(Piece piece : entry.getValue().getPieces()){
|
for(Piece piece : entry.getValue().getPieces()){
|
||||||
System.out.println(piece.getUuid());
|
pieces.add(piece.getUuid());
|
||||||
pieceList.add(piece.getUuid());
|
|
||||||
}
|
}
|
||||||
logic.addNotification(new PlayerInGameNotification(entry.getKey(), pieceList , logic.getGame().getPlayerByColor(entry.getKey()).getName()));
|
logic.addNotification(new PlayerInGameNotification(entry.getValue().getColor(), pieces, entry.getValue().getName()));
|
||||||
}
|
}
|
||||||
logic.setState(logic.getGameState());
|
logic.setState(logic.getGameState());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user