Merge branch 'development2' of https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-01 into development2
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
|
||||||
|
|||||||
@@ -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