added an ArrayList of Player in game and added the received methods in clientgamelogic
This commit is contained in:
@@ -19,6 +19,7 @@ public class Game {
|
||||
private Board board;
|
||||
private Color activeColor;
|
||||
private List<Color> order;
|
||||
private final ArrayList<Player> playerList = new ArrayList<>(4);
|
||||
|
||||
private final ArrayList<Observer> observers = new ArrayList<>();
|
||||
private Player startPlayer;
|
||||
@@ -400,4 +401,16 @@ public Piece getPieceThroughIdentifier(String identifier) {
|
||||
int index = Integer.parseInt(parts[1]);
|
||||
return board.getPlayerData().get(color).getPieces()[index];
|
||||
}
|
||||
|
||||
public ArrayList<Player> getPlayerList() {
|
||||
return playerList;
|
||||
}
|
||||
|
||||
public void addPlayerToList(Player player) {
|
||||
playerList.add(player);
|
||||
}
|
||||
|
||||
public void removePlayerFromList(Player player) {
|
||||
playerList.remove(player);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,6 +11,7 @@ public class Player {
|
||||
private Statistic playerStatistic;
|
||||
private ArrayList<BonusCard> handCards;
|
||||
private final int id;
|
||||
private Color color;
|
||||
|
||||
/**
|
||||
* This constructor constructs a new Player object
|
||||
@@ -88,4 +89,22 @@ public BonusCard removeHandCard(BonusCard card) {
|
||||
public int getId() {
|
||||
return id;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method returns the color of the player
|
||||
*
|
||||
* @return the color of the player
|
||||
*/
|
||||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
/**
|
||||
* This method sets the color of the player
|
||||
*
|
||||
* @param color the new color of the player
|
||||
*/
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user