Add name to player model
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@145 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
7ee737f0d3
commit
63ffedd7b0
5 changed files with 26 additions and 10 deletions
|
@ -13,10 +13,10 @@ public class MockGameState implements IGameState {
|
|||
public MockGameState() {
|
||||
table = new MockTable();
|
||||
players = new ArrayList<MockPlayer>();
|
||||
players.add(new MockPlayer(Color.red));
|
||||
players.add(new MockPlayer(Color.yellow));
|
||||
players.add(new MockPlayer(Color.green));
|
||||
players.add(new MockPlayer(Color.black));
|
||||
players.add(new MockPlayer("Player 1", Color.RED));
|
||||
players.add(new MockPlayer("Player 2", Color.YELLOW));
|
||||
players.add(new MockPlayer("Player 3", Color.GREEN));
|
||||
players.add(new MockPlayer("Player 4", Color.BLACK));
|
||||
activePlayer = 0;
|
||||
gameHeap = new StoneHeap();
|
||||
}
|
||||
|
|
|
@ -5,12 +5,14 @@ import java.awt.Color;
|
|||
public class MockPlayer implements IPlayer {
|
||||
|
||||
public MockHand hand;
|
||||
public String name;
|
||||
public Color color;
|
||||
|
||||
// private String name;
|
||||
|
||||
public MockPlayer(Color color) {
|
||||
public MockPlayer(String name, Color color) {
|
||||
hand = new MockHand();
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
@ -23,4 +25,9 @@ public class MockPlayer implements IPlayer {
|
|||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,10 +14,10 @@ public class GameState implements IGameState {
|
|||
public GameState() {
|
||||
table = new Table();
|
||||
players = new ArrayList<Player>();
|
||||
players.add(new Player(Color.red));
|
||||
players.add(new Player(Color.yellow));
|
||||
players.add(new Player(Color.green));
|
||||
players.add(new Player(Color.black));
|
||||
players.add(new Player("Player 1", Color.RED));
|
||||
players.add(new Player("Player 2", Color.YELLOW));
|
||||
players.add(new Player("Player 3", Color.GREEN));
|
||||
players.add(new Player("Player 4", Color.BLACK));
|
||||
activePlayer = 0;
|
||||
gameHeap = new StoneHeap();
|
||||
}
|
||||
|
|
|
@ -8,4 +8,6 @@ public interface IPlayer {
|
|||
|
||||
public Color getColor();
|
||||
|
||||
public String getName();
|
||||
|
||||
}
|
|
@ -6,12 +6,14 @@ import java.awt.Color;
|
|||
public class Player implements IPlayer {
|
||||
|
||||
private IHand hand;
|
||||
private String name;
|
||||
private Color color;
|
||||
|
||||
// private String name;
|
||||
|
||||
public Player(Color color) {
|
||||
public Player(String name, Color color) {
|
||||
hand = new Hand();
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
}
|
||||
|
||||
|
@ -24,4 +26,9 @@ public class Player implements IPlayer {
|
|||
public Color getColor() {
|
||||
return color;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue