Changed: Now Displays When a player is disconnected in GUI
This commit is contained in:
@@ -6,13 +6,20 @@ import it.polimi.ingsw.gc14.Model.MiniModel;
|
||||
import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
|
||||
import javax.smartcardio.Card;
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* NetworkEvent to avoid drawing a card from the lower card list
|
||||
*/
|
||||
public class DisconnectedPlayer extends NetworkEvent implements Serializable{
|
||||
private ArrayList<String> disconnectedPlayers;
|
||||
|
||||
public void setDisconnected(ArrayList<String> players)
|
||||
{
|
||||
this.disconnectedPlayers=players;
|
||||
}
|
||||
/**
|
||||
* Class constructor.
|
||||
* Initializes all the attributes.
|
||||
@@ -22,6 +29,7 @@ public class DisconnectedPlayer extends NetworkEvent implements Serializable{
|
||||
super(username, EventType.DISCONNECTED_PLAYER, false, ErrorType.GENERIC_ERROR);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @param gameController the Game Controller on which to apply the event
|
||||
* @return true if the player could skipTheTurn, false otherwise
|
||||
@@ -42,6 +50,7 @@ public class DisconnectedPlayer extends NetworkEvent implements Serializable{
|
||||
miniModel.setOrderLogicCard(orderLogicCard);
|
||||
miniModel.setCurrentState(currentState);
|
||||
miniModel.setSlotPlayerMap(slotPlayerMap);
|
||||
miniModel.setDisconnectedPlayers(disconnectedPlayers);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -7,12 +7,17 @@ import it.polimi.ingsw.gc14.Network.EventType;
|
||||
import it.polimi.ingsw.gc14.Network.NetworkEvent;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* Network event used to notify that a player has reconnected to the game.
|
||||
*/
|
||||
public class ReconnectPlayer extends NetworkEvent implements Serializable {
|
||||
|
||||
private ArrayList<String> disconnectedPlayers;
|
||||
public void setDisconnected(ArrayList<String> players)
|
||||
{
|
||||
this.disconnectedPlayers=players;
|
||||
}
|
||||
/**
|
||||
* Constructs a reconnection event for the specified player.
|
||||
*
|
||||
@@ -55,6 +60,7 @@ public class ReconnectPlayer extends NetworkEvent implements Serializable {
|
||||
miniModel.setOrderLogicCard(orderLogicCard);
|
||||
miniModel.setCurrentState(currentState);
|
||||
miniModel.setSlotPlayerMap(slotPlayerMap);
|
||||
miniModel.setDisconnectedPlayers(disconnectedPlayers);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user