mirror of
https://athene2.informatik.unibw-muenchen.de/progproj/gruppen-ht24/Gruppe-02.git
synced 2025-01-19 00:06:16 +01:00
trigger winner and looser popup
This commit is contained in:
parent
11f4560745
commit
dd002746aa
@ -494,6 +494,7 @@ public class Player implements FieldVisitor<Void>{
|
||||
*/
|
||||
private static int rollDice() {
|
||||
return random.nextInt(6) + 1;
|
||||
// return 3;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -20,6 +20,7 @@ import pp.monopoly.message.client.RollDice;
|
||||
import pp.monopoly.message.client.TradeOffer;
|
||||
import pp.monopoly.message.client.TradeResponse;
|
||||
import pp.monopoly.message.client.ViewAssetsRequest;
|
||||
import pp.monopoly.message.server.GameOver;
|
||||
import pp.monopoly.message.server.GameStart;
|
||||
import pp.monopoly.message.server.NextPlayerTurn;
|
||||
import pp.monopoly.message.server.PlayerStatusUpdate;
|
||||
@ -182,8 +183,14 @@ public class ServerGameLogic implements ClientInterpreter {
|
||||
send(next, new NextPlayerTurn());
|
||||
send(next, new PlayerStatusUpdate(playerHandler));
|
||||
send(player, new PlayerStatusUpdate(playerHandler));
|
||||
} else {
|
||||
send(player, new GameOver(false));
|
||||
playerHandler.removePlayer(player);
|
||||
}
|
||||
}
|
||||
if(playerHandler.getPlayers().size() == 1) {
|
||||
send(playerHandler.getPlayerAtIndex(0), new GameOver(true));
|
||||
}
|
||||
updateAllPlayers();
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,7 @@ import pp.monopoly.message.client.ViewAssetsRequest;
|
||||
import pp.monopoly.message.server.BuyPropertyRequest;
|
||||
import pp.monopoly.message.server.DiceResult;
|
||||
import pp.monopoly.message.server.EventDrawCard;
|
||||
import pp.monopoly.message.server.GameOver;
|
||||
import pp.monopoly.message.server.GameStart;
|
||||
import pp.monopoly.message.server.JailEvent;
|
||||
import pp.monopoly.message.server.NextPlayerTurn;
|
||||
@ -176,6 +177,7 @@ public class MonopolyServer implements MessageListener<HostedConnection>, Connec
|
||||
Serializer.registerClass(NotificationMessage.class);
|
||||
Serializer.registerClass(JailEvent.class);
|
||||
Serializer.registerClass(AlterProperty.class);
|
||||
Serializer.registerClass(GameOver.class);
|
||||
}
|
||||
|
||||
private void registerListeners() {
|
||||
|
Loading…
Reference in New Issue
Block a user