From 1243fd98d659c655f2068e545cf2e64803bc4ff2 Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Thu, 23 Apr 2026 17:39:23 +0200 Subject: [PATCH 1/3] Refactor: RMI Fixed: NetworkEvents --- .../ingsw/gc14/Network/NetworkEvent.java | 9 +- .../gc14/Network/NetworkEvents/AddPlayer.java | 4 +- .../NetworkEvents/DrawLowerBuildingCard.java | 5 +- .../NetworkEvents/DrawLowerTribeCard.java | 4 +- .../NetworkEvents/DrawUpperBuildingCard.java | 4 +- .../NetworkEvents/DrawUpperTribeCard.java | 4 +- .../PickOptionalBuildingCard.java | 4 +- .../NetworkEvents/PickOptionalTribeCard.java | 4 +- .../Network/NetworkEvents/SlotChoice.java | 4 +- .../RMI/Client/ClientCallbackImpl.java | 1 + .../gc14/Network/RMI/Client/GameClient.java | 10 -- .../gc14/Network/RMI/Client/RMIClient.java | 13 +-- .../{Client => Common}/IClientCallback.java | 2 +- .../RMI/{Server => Common}/IGameServer.java | 3 +- .../gc14/Network/RMI/Server/IRMIServer.java | 9 -- .../Network/RMI/Server/RMIGameController.java | 59 ------------ .../gc14/Network/RMI/Server/RMIServer.java | 94 ++++++++++++++++--- 17 files changed, 104 insertions(+), 129 deletions(-) delete mode 100644 src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/GameClient.java rename src/main/java/it/polimi/ingsw/gc14/Network/RMI/{Client => Common}/IClientCallback.java (87%) rename src/main/java/it/polimi/ingsw/gc14/Network/RMI/{Server => Common}/IGameServer.java (70%) delete mode 100644 src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IRMIServer.java delete mode 100644 src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIGameController.java diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java index 6e0f683..5e3d45b 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java @@ -1,6 +1,7 @@ package it.polimi.ingsw.gc14.Network; import it.polimi.ingsw.gc14.Controller.GameController; +import javafx.event.Event; import java.io.Serializable; @@ -9,9 +10,11 @@ public abstract class NetworkEvent implements Serializable { public String getUsername() { return username; } - public NetworkEvent() - { - + protected EventType eventType; + public EventType getEventType() {return eventType;} + protected NetworkEvent(String username, EventType eventType) { + this.username = username; + this.eventType = eventType; } public NetworkEvent(String username) { this.username = username; diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/AddPlayer.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/AddPlayer.java index 3d3a9c5..602a231 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/AddPlayer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/AddPlayer.java @@ -8,10 +8,8 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class AddPlayer extends NetworkEvent implements Serializable { - private EventType eventType; public AddPlayer(String username) { - this.username = username; - this.eventType = EventType.ADD_PLAYER; + super(username, EventType.ADD_PLAYER); } @Override public boolean apply(GameController gameController) diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerBuildingCard.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerBuildingCard.java index a4910dd..2456a6a 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerBuildingCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerBuildingCard.java @@ -8,13 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class DrawLowerBuildingCard extends NetworkEvent implements Serializable{ - - private EventType eventType; private int pos; public DrawLowerBuildingCard(String username, int pos){ - this.username = username; - this.eventType = EventType.DRAW_LOWER_BUILD; + super(username, EventType.DRAW_LOWER_BUILD); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerTribeCard.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerTribeCard.java index 85f4598..64b0a17 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerTribeCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawLowerTribeCard.java @@ -8,12 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class DrawLowerTribeCard extends NetworkEvent implements Serializable{ - private EventType eventType; private int pos; public DrawLowerTribeCard(String username, int pos){ - this.username = username; - this.eventType = EventType.DRAW_LOWER_TRIBE; + super(username, EventType.DRAW_LOWER_TRIBE); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperBuildingCard.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperBuildingCard.java index 77f7c60..5f0a985 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperBuildingCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperBuildingCard.java @@ -8,12 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class DrawUpperBuildingCard extends NetworkEvent implements Serializable{ - private EventType eventType; private int pos; public DrawUpperBuildingCard(String username, int pos){ - this.username = username; - this.eventType = EventType.DRAW_UPPER_BUILD; + super(username, EventType.DRAW_UPPER_BUILD); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperTribeCard.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperTribeCard.java index 0f6d04d..69ab281 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperTribeCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/DrawUpperTribeCard.java @@ -8,12 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class DrawUpperTribeCard extends NetworkEvent implements Serializable{ - private EventType eventType; private int pos; public DrawUpperTribeCard(String username, int pos){ - this.username = username; - this.eventType = EventType.DRAW_UPPER_TRIBE; + super(username, EventType.DRAW_UPPER_TRIBE); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalBuildingCard.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalBuildingCard.java index dcf3822..a1fde73 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalBuildingCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalBuildingCard.java @@ -8,12 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class PickOptionalBuildingCard extends NetworkEvent implements Serializable{ - private EventType eventType; private int pos; public PickOptionalBuildingCard(String username, int pos){ - this.username = username; - this.eventType = EventType.PICK_OPTIONAL_BUILD; + super(username, EventType.PICK_OPTIONAL_BUILD); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalTribeCard.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalTribeCard.java index 46cc783..d739e3c 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalTribeCard.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/PickOptionalTribeCard.java @@ -8,12 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class PickOptionalTribeCard extends NetworkEvent implements Serializable{ - private EventType eventType; private int pos; public PickOptionalTribeCard(String username, int pos){ - this.username = username; - this.eventType = EventType.PICK_OPTIONAL_TRIBE; + super(username, EventType.PICK_OPTIONAL_TRIBE); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/SlotChoice.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/SlotChoice.java index 700335a..97000d9 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/SlotChoice.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvents/SlotChoice.java @@ -8,12 +8,10 @@ import it.polimi.ingsw.gc14.View.IView; import java.io.Serializable; public class SlotChoice extends NetworkEvent implements Serializable { - private EventType eventType; private int pos; public SlotChoice(String username, int pos) { - this.username = username; - this.eventType = EventType.SLOT_CHOICE; + super(username, EventType.SLOT_CHOICE); this.pos = pos; } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java index d79d357..64c53e9 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java @@ -3,6 +3,7 @@ package it.polimi.ingsw.gc14.Network.RMI.Client; import it.polimi.ingsw.gc14.Controller.ClientController; import it.polimi.ingsw.gc14.Model.Game; import it.polimi.ingsw.gc14.Network.NetworkEvent; +import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback; import java.rmi.RemoteException; import java.rmi.server.UnicastRemoteObject; diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/GameClient.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/GameClient.java deleted file mode 100644 index ffb42ff..0000000 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/GameClient.java +++ /dev/null @@ -1,10 +0,0 @@ -package it.polimi.ingsw.gc14.Network.RMI.Client; - -import it.polimi.ingsw.gc14.Controller.ClientController; -import it.polimi.ingsw.gc14.Network.NetworkEvent; -import it.polimi.ingsw.gc14.View.IView; - -public interface GameClient { - boolean connect( String username,ClientController clientController ); - void doEvent(NetworkEvent event) throws Exception; -} diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/RMIClient.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/RMIClient.java index 39ada7c..ac0e14b 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/RMIClient.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/RMIClient.java @@ -1,15 +1,12 @@ package it.polimi.ingsw.gc14.Network.RMI.Client; -import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; -import java.rmi.server.UnicastRemoteObject; import it.polimi.ingsw.gc14.Controller.ClientController; import it.polimi.ingsw.gc14.Network.NetworkEvent; -import it.polimi.ingsw.gc14.Network.RMI.Server.*; -import it.polimi.ingsw.gc14.View.IView; +import it.polimi.ingsw.gc14.Network.RMI.Common.IGameServer; -public class RMIClient implements GameClient { +public class RMIClient { private final String host; private final int port; @@ -20,7 +17,7 @@ public class RMIClient implements GameClient { this.port = port; } - @Override + public boolean connect(String username,ClientController clientController) { // 1. Connettiti al registry try { @@ -49,8 +46,8 @@ public class RMIClient implements GameClient { } - @Override - public void doEvent( NetworkEvent event) throws Exception { + + public void doEvent(NetworkEvent event) throws Exception { stub.doEvent(event); } diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/IClientCallback.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java similarity index 87% rename from src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/IClientCallback.java rename to src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java index 0d3772f..5ff2b0b 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/IClientCallback.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IClientCallback.java @@ -1,4 +1,4 @@ -package it.polimi.ingsw.gc14.Network.RMI.Client; +package it.polimi.ingsw.gc14.Network.RMI.Common; import it.polimi.ingsw.gc14.Model.Game; import it.polimi.ingsw.gc14.Network.NetworkEvent; diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IGameServer.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java similarity index 70% rename from src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IGameServer.java rename to src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java index 17398b1..8bcaff6 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IGameServer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Common/IGameServer.java @@ -1,6 +1,5 @@ -package it.polimi.ingsw.gc14.Network.RMI.Server; +package it.polimi.ingsw.gc14.Network.RMI.Common; -import it.polimi.ingsw.gc14.Network.RMI.Client.IClientCallback; import it.polimi.ingsw.gc14.Network.NetworkEvent; import java.rmi.*; diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IRMIServer.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IRMIServer.java deleted file mode 100644 index 70d7813..0000000 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/IRMIServer.java +++ /dev/null @@ -1,9 +0,0 @@ -package it.polimi.ingsw.gc14.Network.RMI.Server; - -import java.rmi.RemoteException; - -public interface IRMIServer { - - void add(Integer number) throws RemoteException; - void reset() throws RemoteException; -} diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIGameController.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIGameController.java deleted file mode 100644 index 2f7cf82..0000000 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIGameController.java +++ /dev/null @@ -1,59 +0,0 @@ -package it.polimi.ingsw.gc14.Network.RMI.Server; - -import it.polimi.ingsw.gc14.Controller.GameController; -import it.polimi.ingsw.gc14.Model.Game; -import it.polimi.ingsw.gc14.Network.RMI.Client.IClientCallback; -import it.polimi.ingsw.gc14.Network.NetworkEvent; -import it.polimi.ingsw.gc14.Network.NetworkEvents.DrawUpperBuildingCard; - -import java.rmi.*; -import java.util.concurrent.ConcurrentHashMap; -import java.util.*; - -public class RMIGameController implements IGameServer { - - private final GameController controller; - private final Map clients = new ConcurrentHashMap<>(); - - public RMIGameController(GameController controller) { - this.controller = controller; - } - - @Override - public boolean joinGame(String username, IClientCallback callback) { - if(controller.addPlayer(username)) - { - clients.put(username, callback); - return true; - } - return false; - } - - - @Override - public boolean doEvent(NetworkEvent event) throws RemoteException { - boolean result = event.apply(controller); - if (!result) { - notifyError(event.getUsername(),"Mossa non valida"); - } else { - notifyAll(event); - } - return result; - } - - private void notifyAll(NetworkEvent action) throws RemoteException { - for (IClientCallback cb : clients.values()) { - cb.onAction(action); - } - } - private void notifyAll(Game model) throws RemoteException { - for (IClientCallback cb : clients.values()) { - cb.onGameInit(model); - } - } - - private void notifyError(String username, String message) throws RemoteException { - IClientCallback cb = clients.get(username); - if (cb != null) cb.onError(message); - } -} \ No newline at end of file diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java index e07a1da..9a82dec 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Server/RMIServer.java @@ -1,28 +1,92 @@ package it.polimi.ingsw.gc14.Network.RMI.Server; import it.polimi.ingsw.gc14.Controller.GameController; +import it.polimi.ingsw.gc14.Model.Game; +import it.polimi.ingsw.gc14.Network.NetworkEvent; +import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback; +import it.polimi.ingsw.gc14.Network.RMI.Common.IGameServer; import java.rmi.RemoteException; import java.rmi.registry.LocateRegistry; import java.rmi.registry.Registry; import java.rmi.server.UnicastRemoteObject; +import java.util.Map; +import java.util.concurrent.ConcurrentHashMap; -public class RMIServer { - private final RMIGameController controller; +import java.rmi.*; + +public class RMIServer implements IGameServer { + + private GameController controller; private Registry registry; private int nPort; - public RMIServer(RMIGameController controller, int nPort) { + private final Map clients = new ConcurrentHashMap<>(); + + + // Costruttore + public RMIServer(GameController controller, int nPort) throws RemoteException { this.controller = controller; this.nPort = nPort; } - public boolean start() throws Exception { + + + + // Metodi esposti RMI + public void setController (GameController controller) { + this.controller = controller; + } + @Override + public boolean joinGame(String username, IClientCallback callback) { + if(controller.addPlayer(username)) + { + clients.put(username, callback); + return true; + } + return false; + } + @Override + public boolean doEvent(NetworkEvent event) throws RemoteException { + boolean result = event.apply(controller); + if (!result) { + notifyError(event.getUsername(),"Mossa non valida"); + } else { + notifyAll(event); + } + return result; + } + + + + + + // Metodi interni del server + private void notifyAll(NetworkEvent action) throws RemoteException { + for (IClientCallback cb : clients.values()) { + cb.onAction(action); + } + } + private void notifyAll(Game model) throws RemoteException { + for (IClientCallback cb : clients.values()) { + cb.onGameInit(model); + } + } + private void notifyError(String username, String message) throws RemoteException { + IClientCallback cb = clients.get(username); + if (cb != null) cb.onError(message); + } + + + + + + // Metodi per avviare server RMI + public boolean start() { try { - IGameServer stub = (IGameServer) UnicastRemoteObject.exportObject(controller, 0); registry = LocateRegistry.createRegistry(nPort); - registry.rebind("RMIGameServer", stub); + registry.rebind("RMIGameServer", this); System.out.println("RMI Server avviato sulla porta "+nPort); return true; } @@ -31,11 +95,17 @@ public class RMIServer { return false; } } - - - public void stop() throws Exception { - registry.unbind("RMIGameServer"); - UnicastRemoteObject.unexportObject(controller, true); - System.out.println("RMI Server fermato"); + public boolean stop() { + try { + registry.unbind("RMIGameServer"); + UnicastRemoteObject.unexportObject(this, true); + System.out.println("RMI Server fermato"); + return true; + } catch (RemoteException | NotBoundException e) { + e.printStackTrace(); + return false; + } } + + } From 9760144faa9563810da6dc6202a2c293cb7b0c4a Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Thu, 23 Apr 2026 17:49:57 +0200 Subject: [PATCH 2/3] Fix: NetworkEvent MicroFix: ShamanicRitual JavaDOC --- .../gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java | 3 +-- src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java index a9de6e2..b447c13 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java +++ b/src/main/java/it/polimi/ingsw/gc14/Model/Cards/TribeCards/Events/ShamanicRitual.java @@ -43,7 +43,7 @@ public class ShamanicRitual extends EventCard { * If all players have the same amount of icons, they all gain and lose Prestige Points. * * Buildings influence: - * Building 2: if you have fewer icons than all other players, you don't lose Prestige Points + * Building 2: if you have the lowest number of icons, you don't lose Prestige Points * Building 5: during the Shamanic Ritual, you gain 3 icons * Building 6: if you have more icons than any other player, you gain double of Prestige Points * @@ -87,7 +87,6 @@ public class ShamanicRitual extends EventCard { } - /** * Creates and returns a copy of this ShamanicRitual card. * diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java index 5e3d45b..abc510c 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/NetworkEvent.java @@ -16,8 +16,6 @@ public abstract class NetworkEvent implements Serializable { this.username = username; this.eventType = eventType; } - public NetworkEvent(String username) { - this.username = username; - } + public abstract boolean apply(GameController gameController); } From 5ff35816a9e64599fbf83228dadba507ed69c408 Mon Sep 17 00:00:00 2001 From: AleandroPagani Date: Thu, 23 Apr 2026 18:59:14 +0200 Subject: [PATCH 3/3] Add: ServerLauncher --- .../ingsw/gc14/Controller/ClientController.java | 2 +- src/main/java/it/polimi/ingsw/gc14/Launcher.java | 9 --------- .../gc14/Network/RMI/Client/ClientCallbackImpl.java | 2 +- .../java/it/polimi/ingsw/gc14/ServerLauncher.java | 11 +++++++++++ 4 files changed, 13 insertions(+), 11 deletions(-) delete mode 100644 src/main/java/it/polimi/ingsw/gc14/Launcher.java create mode 100644 src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java diff --git a/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java b/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java index e330a90..d206d22 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java +++ b/src/main/java/it/polimi/ingsw/gc14/Controller/ClientController.java @@ -8,7 +8,7 @@ public class ClientController { private Game localModel; public GameController localController; - private final IView view; + public final IView view; public ClientController(IView view,Game localModel) { this.view = view; diff --git a/src/main/java/it/polimi/ingsw/gc14/Launcher.java b/src/main/java/it/polimi/ingsw/gc14/Launcher.java deleted file mode 100644 index 146cfd6..0000000 --- a/src/main/java/it/polimi/ingsw/gc14/Launcher.java +++ /dev/null @@ -1,9 +0,0 @@ -package it.polimi.ingsw.gc14; - -import javafx.application.Application; - -public class Launcher { - public static void main(String[] args) { - Application.launch(HelloApplication.class, args); - } -} diff --git a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java index 64c53e9..d6b54d7 100644 --- a/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java +++ b/src/main/java/it/polimi/ingsw/gc14/Network/RMI/Client/ClientCallbackImpl.java @@ -24,9 +24,9 @@ public class ClientCallbackImpl extends UnicastRemoteObject implements IClientCa @Override public void onAction(NetworkEvent event) throws RemoteException { event.apply(clientController.localController); // delega tutto al controller + //clientController.view.update(); TODO } - @Override public void onError(String message) throws RemoteException { clientController.onError(message); diff --git a/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java b/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java new file mode 100644 index 0000000..a1bd487 --- /dev/null +++ b/src/main/java/it/polimi/ingsw/gc14/ServerLauncher.java @@ -0,0 +1,11 @@ +package it.polimi.ingsw.gc14; + + +public class ServerLauncher { + public static void main(String[] args){ + // TODO + // Deve avere una coda con gli eventi. + // Il server RMI e il server TCP quando ricevono un doEvent devono aggiungere l'evento alla coda condivisa + // Questa classe esegue gli eventi nella coda e chiama il notify all e notify error sia RMI che TCP + } +}