merge
This commit is contained in:
@@ -119,6 +119,10 @@ private void handleGame(Notification notification) {
|
|||||||
guiHandler.addCardOwn(n.getBonusCard());
|
guiHandler.addCardOwn(n.getBonusCard());
|
||||||
app.getAcousticHandler().playSound(MdgaSound.BONUS);
|
app.getAcousticHandler().playSound(MdgaSound.BONUS);
|
||||||
delay = STANDARD_DELAY;
|
delay = STANDARD_DELAY;
|
||||||
|
} else if(notification instanceof RankingResponceNotification n) {
|
||||||
|
n.getRankingResults().forEach((c, i) -> {
|
||||||
|
guiHandler.rollRankingResult(c, i);
|
||||||
|
});
|
||||||
} else if (notification instanceof ActivePlayerNotification n) {
|
} else if (notification instanceof ActivePlayerNotification n) {
|
||||||
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
gameView.getGuiHandler().setActivePlayer(n.getColor());
|
||||||
boardHandler.hideDice();
|
boardHandler.hideDice();
|
||||||
|
|||||||
@@ -3,9 +3,14 @@
|
|||||||
import pp.mdga.client.ClientGameLogic;
|
import pp.mdga.client.ClientGameLogic;
|
||||||
import pp.mdga.client.ClientState;
|
import pp.mdga.client.ClientState;
|
||||||
import pp.mdga.client.gamestate.DetermineStartPlayerState;
|
import pp.mdga.client.gamestate.DetermineStartPlayerState;
|
||||||
|
import pp.mdga.game.Color;
|
||||||
import pp.mdga.message.client.AnimationEndMessage;
|
import pp.mdga.message.client.AnimationEndMessage;
|
||||||
import pp.mdga.message.server.*;
|
import pp.mdga.message.server.*;
|
||||||
import pp.mdga.notification.ActivePlayerNotification;
|
import pp.mdga.notification.ActivePlayerNotification;
|
||||||
|
import pp.mdga.notification.RankingResponceNotification;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
public class WaitRankingState extends DetermineStartPlayerStates {
|
public class WaitRankingState extends DetermineStartPlayerStates {
|
||||||
|
|
||||||
@@ -45,7 +50,11 @@ public void received(DiceNowMessage msg){
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void received(RankingResponseMessage msg){
|
public void received(RankingResponseMessage msg){
|
||||||
|
Map<Color, Integer> rankingResults = new HashMap<>();
|
||||||
|
for (var entry : msg.getRankingResults().entrySet()) {
|
||||||
|
rankingResults.put(logic.getGame().getPlayerById(entry.getKey()).getColor(), entry.getValue());
|
||||||
|
}
|
||||||
|
logic.addNotification(new RankingResponceNotification(rankingResults));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
@@ -37,6 +37,8 @@ public void enter() {
|
|||||||
ArrayList<UUID> ownPieces = new ArrayList<>(possibleOwnPieces.stream().map(Piece::getUuid).toList());
|
ArrayList<UUID> ownPieces = new ArrayList<>(possibleOwnPieces.stream().map(Piece::getUuid).toList());
|
||||||
ArrayList<UUID> enemyPieces = new ArrayList<>(possibleEnemyPieces.stream().map(Piece::getUuid).toList());
|
ArrayList<UUID> enemyPieces = new ArrayList<>(possibleEnemyPieces.stream().map(Piece::getUuid).toList());
|
||||||
logic.addNotification(new SelectableSwapNotification(ownPieces, enemyPieces));
|
logic.addNotification(new SelectableSwapNotification(ownPieces, enemyPieces));
|
||||||
|
possibleOwnPieces = null;
|
||||||
|
possibleEnemyPieces = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -55,7 +57,7 @@ public void setPossibleEnemyPieces(ArrayList<Piece> possibleEnemyPieces) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void selectPiece(Piece piece) {
|
public void selectPiece(Piece piece){
|
||||||
if (possibleOwnPieces.contains(piece)){
|
if (possibleOwnPieces.contains(piece)){
|
||||||
selectedOwnPiece = piece;
|
selectedOwnPiece = piece;
|
||||||
} else if (possibleEnemyPieces.contains(piece)){
|
} else if (possibleEnemyPieces.contains(piece)){
|
||||||
|
|||||||
@@ -88,7 +88,7 @@ public Game() {
|
|||||||
initializeDrawPile();
|
initializeDrawPile();
|
||||||
board = new Board();
|
board = new Board();
|
||||||
die = new Die(1,2,
|
die = new Die(1,2,
|
||||||
1,1,6,1
|
1,1,6,1,6
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,30 @@
|
|||||||
|
package pp.mdga.notification;
|
||||||
|
|
||||||
|
import pp.mdga.game.Color;
|
||||||
|
import pp.mdga.message.server.ServerMessage;
|
||||||
|
|
||||||
|
import java.util.HashMap;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
public class RankingResponceNotification extends Notification {
|
||||||
|
private final Map<Color, Integer> rankingResults;
|
||||||
|
/**
|
||||||
|
* Constructor.
|
||||||
|
*
|
||||||
|
* @param rankingResults as the results of all players after the start player was determined as a Map combining
|
||||||
|
* Integers and Integers.
|
||||||
|
*/
|
||||||
|
public RankingResponceNotification(Map<Color, Integer> rankingResults) {
|
||||||
|
super();
|
||||||
|
this.rankingResults = rankingResults;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* This method will be used to return rankingResults attribute of RankingResponseMessage class.
|
||||||
|
*
|
||||||
|
* @return rankingResults as a Map combining Integers and Integers.
|
||||||
|
*/
|
||||||
|
public Map<Color, Integer> getRankingResults() {
|
||||||
|
return this.rankingResults;
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user