Fix: only one skipAction(Del:SkipLower/SkipUpper)
This commit is contained in:
@@ -17,9 +17,8 @@ public interface IClient {
|
||||
|
||||
public void drawLowerBuildingCard(String playerUsername,int pos) throws RemoteException;
|
||||
|
||||
public void skipUpper(String playerUsername) throws RemoteException;
|
||||
public void skipTurn(String playerUsername) throws RemoteException;
|
||||
|
||||
public void skipLower(String playerUsername) throws RemoteException;
|
||||
|
||||
|
||||
public void pickOptionalTribeCard(String playerUsername,int pos) throws RemoteException;
|
||||
|
||||
@@ -3,21 +3,20 @@ 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;
|
||||
|
||||
/**
|
||||
* NetworkEvent to avoid drawing a card from the lower card list
|
||||
*/
|
||||
public class SkipLower extends NetworkEvent implements Serializable{
|
||||
public class SkipNoDrawable extends NetworkEvent implements Serializable{
|
||||
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
* @param username the name of the player requesting the event
|
||||
*/
|
||||
public SkipLower(String username){
|
||||
public SkipNoDrawable(String username){
|
||||
super(username, EventType.SKIP_LOWER, false);
|
||||
}
|
||||
|
||||
@@ -27,7 +26,7 @@ public class SkipLower extends NetworkEvent implements Serializable{
|
||||
*/
|
||||
@Override
|
||||
public boolean apply(GameController gameController){
|
||||
return gameController.SkipLowerDrawing(username);
|
||||
return gameController.SkipNoDrawable(username);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -116,23 +116,15 @@ public class RMIClient implements IClient {
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the upper list.
|
||||
* This action is available only when the upper list is empty or the player cannot draw any card.
|
||||
* Requests to skip the turn.
|
||||
* This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipUpper(String playerUsername) throws RemoteException {
|
||||
stub.skipUpper(playerUsername);
|
||||
public void skipTurn(String playerUsername) throws RemoteException {
|
||||
stub.skipTurn(playerUsername);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the lower list.
|
||||
* This action is available only when the lower list is empty or the player cannot draw any card.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipLower(String playerUsername) throws RemoteException {
|
||||
stub.skipLower(playerUsername);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
|
||||
@@ -39,9 +39,8 @@ public interface IGameServer extends Remote {
|
||||
|
||||
void drawLowerBuildingCard(String playerUsername,int pos) throws RemoteException;
|
||||
|
||||
void skipUpper(String playerUsername) throws RemoteException;
|
||||
void skipTurn(String playerUsername) throws RemoteException;
|
||||
|
||||
void skipLower(String playerUsername) throws RemoteException;
|
||||
|
||||
|
||||
void pickOptionalTribeCard(String playerUsername,int pos) throws RemoteException;
|
||||
|
||||
@@ -8,14 +8,11 @@ import it.polimi.ingsw.gc14.Network.NetworkEvents.*;
|
||||
import it.polimi.ingsw.gc14.Network.RMI.Common.IClientCallback;
|
||||
import it.polimi.ingsw.gc14.Network.RMI.Common.IGameServer;
|
||||
|
||||
import java.net.InetAddress;
|
||||
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.Objects;
|
||||
import java.util.Properties;
|
||||
import java.util.concurrent.BlockingQueue;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
@@ -157,24 +154,15 @@ public class RMIServer extends UnicastRemoteObject implements IGameServer {
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the upper list.
|
||||
* This action is available only when the upper list is empty or the player cannot draw any card.
|
||||
* Requests to skip the turn.
|
||||
* This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipUpper(String playerUsername) {
|
||||
actionQueue.offer(new SkipUpper(playerUsername));
|
||||
public void skipTurn(String playerUsername) {
|
||||
actionQueue.offer(new SkipNoDrawable(playerUsername));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the lower list.
|
||||
* This action is available only when the lower list is empty or the player cannot draw any card.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipLower(String playerUsername) {
|
||||
actionQueue.offer(new SkipLower(playerUsername));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Used to draw a tribe card from the upper list.
|
||||
|
||||
@@ -159,23 +159,14 @@ public class TCPClient implements IClient {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the upper list.
|
||||
* This action is available only when the upper list is empty or the player cannot draw any card.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipUpper(String playerUsername) {
|
||||
doEvent(new SkipUpper(playerUsername));
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Requests to skip drawing from the lower list.
|
||||
* This action is available only when the lower list is empty or the player cannot draw any card.
|
||||
* Requests to skip drawing turn.
|
||||
* This action is available only when the player cannot draw any tribe card, but still can buy some buildings.
|
||||
* @param playerUsername the name of the player performing the action
|
||||
*/
|
||||
public void skipLower(String playerUsername) {
|
||||
doEvent(new SkipLower(playerUsername));
|
||||
public void skipTurn(String playerUsername) {
|
||||
doEvent(new SkipNoDrawable(playerUsername));
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user