Add: Added Event Methods For Client-Server Event Execution.
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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 DrawLowerBuildingCard extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public DrawLowerBuildingCard(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.DRAW_LOWER_BUILD;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.drawLowerBuildingCard(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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 DrawLowerTribeCard extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public DrawLowerTribeCard(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.DRAW_LOWER_TRIBE;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.drawLowerTribeCard(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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 DrawUpperBuildingCard extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public DrawUpperBuildingCard(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.DRAW_UPPER_BUILD;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.drawUpperBuildingCard(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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 DrawUpperTribeCard extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public DrawUpperTribeCard(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.DRAW_UPPER_TRIBE;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.drawUpperTribeCard(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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 PickOptionalBuildingCard extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public PickOptionalBuildingCard(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.PICK_OPTIONAL_BUILD;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.pickOptionalBuildingCard(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
+29
@@ -0,0 +1,29 @@
|
|||||||
|
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 PickOptionalTribeCard extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public PickOptionalTribeCard(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.PICK_OPTIONAL_TRIBE;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.pickOptionalTribeCard(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,29 @@
|
|||||||
|
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 SlotChoice extends NetworkEvent implements Serializable{
|
||||||
|
private String username;
|
||||||
|
private EventType eventType;
|
||||||
|
private int pos;
|
||||||
|
|
||||||
|
public SlotChoice(String username, int pos){
|
||||||
|
this.username = username;
|
||||||
|
this.eventType = EventType.SLOT_CHOICE;
|
||||||
|
this.pos = pos;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean apply(GameController gameController){
|
||||||
|
return gameController.slotChoice(username, pos);
|
||||||
|
}
|
||||||
|
|
||||||
|
public String apply(IView gameController){
|
||||||
|
return gameController.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user