Merge branch 'main' into TCP
This commit is contained in:
+1
-1
@@ -1,4 +1,4 @@
|
||||
package it.polimi.ingsw.gc14.Network.Client.TCP;
|
||||
package it.polimi.ingsw.gc14.Network.TCP.Client;
|
||||
|
||||
import it.polimi.ingsw.gc14.View.IView;
|
||||
|
||||
@@ -0,0 +1,12 @@
|
||||
package it.polimi.ingsw.gc14.Network.TCP;
|
||||
|
||||
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.TCP;
|
||||
|
||||
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.TCP.NetworkEvents;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||
import it.polimi.ingsw.gc14.Network.TCP.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.TCP.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();
|
||||
}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package it.polimi.ingsw.gc14.Network.Server.TCP;
|
||||
package it.polimi.ingsw.gc14.Network.TCP.Server;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
package it.polimi.ingsw.gc14.Network.Server.TCP;
|
||||
package it.polimi.ingsw.gc14.Network.TCP.Server;
|
||||
|
||||
import it.polimi.ingsw.gc14.Controller.GameController;
|
||||
|
||||
Reference in New Issue
Block a user