Refactor: Network
This commit is contained in:
@@ -0,0 +1,4 @@
|
|||||||
|
package it.polimi.ingsw.gc14.Network.Client.RMI;
|
||||||
|
|
||||||
|
public class RMIClient {
|
||||||
|
}
|
||||||
@@ -1,4 +1,12 @@
|
|||||||
package it.polimi.ingsw.gc14.Network;
|
package it.polimi.ingsw.gc14.Network;
|
||||||
|
|
||||||
public enum EventType {
|
public enum EventType {
|
||||||
|
ADD_PLAYER,
|
||||||
|
SLOT_CHOICE,
|
||||||
|
DRAW_UPPER_TRIBE,
|
||||||
|
DRAW_LOWER_TRIBE,
|
||||||
|
DRAW_UPPER_BUILD,
|
||||||
|
DRAW_LOWER_BUILD,
|
||||||
|
PICK_OPTIONAL_TRIBE,
|
||||||
|
PICK_OPTIONAL_BUILD
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,10 @@
|
|||||||
|
package it.polimi.ingsw.gc14.Network;
|
||||||
|
|
||||||
|
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public abstract class NetworkEvent implements Serializable {
|
||||||
|
|
||||||
|
public abstract boolean apply(GameController gameController);
|
||||||
|
}
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
package it.polimi.ingsw.gc14.Network.NetworkEvents;
|
||||||
|
|
||||||
|
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||||
|
import it.polimi.ingsw.gc14.Network.EventType;
|
||||||
|
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||||
|
import it.polimi.ingsw.gc14.View.IView;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
|
||||||
|
public class AddPlayer extends NetworkEvent implements Serializable {
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
public AddPlayer(String username) {
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.ADD_PLAYER;
|
||||||
|
}
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController)
|
||||||
|
{
|
||||||
|
return gameController.addPlayer(username);
|
||||||
|
}
|
||||||
|
public String apply(IView gameController)
|
||||||
|
{
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,8 @@
|
|||||||
|
package it.polimi.ingsw.gc14.Network.Server.RMI;
|
||||||
|
|
||||||
|
public class RMIServer {
|
||||||
|
public void Test(String[]args)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user