Fixed: synchronized on client UI
This commit is contained in:
@@ -53,6 +53,8 @@ public class ClientCallbackImpl extends UnicastRemoteObject implements IClientCa
|
||||
*/
|
||||
@Override
|
||||
public void onAction(NetworkEvent event) throws RemoteException {
|
||||
synchronized (clientController)
|
||||
{
|
||||
if(event.getIsError()) {
|
||||
clientController.view.showError(event.toString());
|
||||
} else {
|
||||
@@ -61,3 +63,4 @@ public class ClientCallbackImpl extends UnicastRemoteObject implements IClientCa
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -156,6 +156,7 @@ public class TCPClient implements IClient {
|
||||
e.printStackTrace();
|
||||
break;
|
||||
}
|
||||
synchronized (controller) {
|
||||
if (read instanceof NetworkEvent event) {
|
||||
if (event.getIsError()) {
|
||||
controller.view.showError(event.toString());
|
||||
@@ -168,6 +169,7 @@ public class TCPClient implements IClient {
|
||||
controller.setModel(model);
|
||||
controller.view.render();
|
||||
}
|
||||
}
|
||||
} catch (ClassNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
break;
|
||||
|
||||
@@ -88,6 +88,8 @@ public class MainFXMLController {
|
||||
|
||||
public void render() {
|
||||
|
||||
synchronized (controller)
|
||||
{
|
||||
if (old_state_stage==null) {
|
||||
renderBackground();
|
||||
renderUpper();
|
||||
@@ -117,6 +119,7 @@ public class MainFXMLController {
|
||||
|
||||
old_state_stage=controller.miniModel.currentState.getGameStage();
|
||||
old_state_username=controller.miniModel.currentState.getCurrentPlayer().getUserName();
|
||||
}
|
||||
// TODO: le info in sidepanel non vengono aggiornate sempre aggiornate, bisogna prima capire dove metterle
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user