trigger winner and looser popup

This commit is contained in:
Johannes Schmelz 2024-12-01 20:52:29 +01:00
parent 11f4560745
commit dd002746aa
3 changed files with 10 additions and 0 deletions

View File

@ -494,6 +494,7 @@ public class Player implements FieldVisitor<Void>{
*/
private static int rollDice() {
return random.nextInt(6) + 1;
// return 3;
}
}

View File

@ -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();
}

View File

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