This commit is contained in:
@@ -22,6 +22,8 @@ public class Client {
|
||||
public final Signal onClosed = new Signal();
|
||||
public final Signal onGameStarted = new Signal();
|
||||
|
||||
Player player;
|
||||
|
||||
String disconnectReason = null;
|
||||
|
||||
public Client(String address, short port) throws UnknownHostException, IOException {
|
||||
@@ -70,4 +72,8 @@ public class Client {
|
||||
}
|
||||
}
|
||||
|
||||
public Player getPlayer() {
|
||||
return player;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -21,7 +21,6 @@ import sudoku.io.SudokuSerializer;
|
||||
public class ClientConnexion extends Connexion {
|
||||
|
||||
private final Client client;
|
||||
private Player player = null;
|
||||
|
||||
public ClientConnexion(String address, short port, Client client) throws UnknownHostException, IOException {
|
||||
super(new Socket(address, port));
|
||||
@@ -38,7 +37,7 @@ public class ClientConnexion extends Connexion {
|
||||
|
||||
@Override
|
||||
public void visitPacket(ConnexionInfoPacket packet) {
|
||||
this.player = this.client.getGame().getPlayerById(packet.getConnectionId());
|
||||
this.client.player = this.client.getGame().getPlayerById(packet.getConnectionId());
|
||||
client.onConnect.emit();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user