feat: multi synced player scores
All checks were successful
Linux arm64 / Build (push) Successful in 31s
All checks were successful
Linux arm64 / Build (push) Successful in 31s
This commit is contained in:
@@ -6,13 +6,16 @@ import java.net.UnknownHostException;
|
||||
|
||||
import game.Player;
|
||||
import network.Connexion;
|
||||
import network.protocol.packets.ChangeCellPacket;
|
||||
import network.protocol.packets.ConnexionInfoPacket;
|
||||
import network.protocol.packets.DisconnectPacket;
|
||||
import network.protocol.packets.EndGamePacket;
|
||||
import network.protocol.packets.KeepAlivePacket;
|
||||
import network.protocol.packets.LoginPacket;
|
||||
import network.protocol.packets.PlayerJoinPacket;
|
||||
import network.protocol.packets.PlayerLeavePacket;
|
||||
import network.protocol.packets.StartGamePacket;
|
||||
import network.protocol.packets.UpdatePlayerScorePacket;
|
||||
import sudoku.io.SudokuSerializer;
|
||||
|
||||
public class ClientConnexion extends Connexion {
|
||||
@@ -73,4 +76,23 @@ public class ClientConnexion extends Connexion {
|
||||
this.client.onGameStarted.emit();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPacket(EndGamePacket packet) {
|
||||
// TODO Auto-generated method stub
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitPacket'");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPacket(UpdatePlayerScorePacket packet) {
|
||||
Player player = this.client.getGame().getPlayerById(packet.getPlayerId());
|
||||
assert(player != null);
|
||||
player.setScore(packet.getCellsLeft());
|
||||
System.out.println("Score for " + player.getPseudo() + " : " + packet.getCellsLeft());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void visitPacket(ChangeCellPacket packet) {
|
||||
throw new UnsupportedOperationException("Unimplemented method 'visitPacketChangeCell'");
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user