Added TurnControlFactory
git-svn-id: svn://sunsvr01.isp.uni-luebeck.de/swproj13/trunk@308 72836036-5685-4462-b002-a69064685172
This commit is contained in:
parent
73f6fb9c1b
commit
eb7ccb46c5
4 changed files with 86 additions and 15 deletions
|
@ -2,24 +2,46 @@ package jrummikub.model;
|
|||
|
||||
import java.awt.Color;
|
||||
|
||||
import jrummikub.control.turn.HumanTurnControl;
|
||||
import jrummikub.control.turn.TurnControlFactory;
|
||||
|
||||
/**
|
||||
* The settings of a player
|
||||
*/
|
||||
public class PlayerSettings {
|
||||
private String name;
|
||||
private Color color;
|
||||
private TurnControlFactory turnControlFactory;
|
||||
|
||||
/**
|
||||
* Create a new player
|
||||
*
|
||||
* @param name
|
||||
* the player's name
|
||||
* @param color
|
||||
* the player's color
|
||||
* @param turnControlFactory
|
||||
* the player's {@link TurnControlFactory}
|
||||
*/
|
||||
public PlayerSettings(String name, Color color,
|
||||
TurnControlFactory turnControlFactory) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.turnControlFactory = turnControlFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a new human player
|
||||
*
|
||||
* @param name
|
||||
* the player's name
|
||||
* the player's name
|
||||
* @param color
|
||||
* the player's color
|
||||
* the player's color
|
||||
*/
|
||||
public PlayerSettings(String name, Color color) {
|
||||
this.name = name;
|
||||
this.color = color;
|
||||
this.turnControlFactory = HumanTurnControl.getFactory();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -44,7 +66,7 @@ public class PlayerSettings {
|
|||
* Sets the player's color
|
||||
*
|
||||
* @param color
|
||||
* the new color
|
||||
* the new color
|
||||
*/
|
||||
public void setColor(Color color) {
|
||||
this.color = color;
|
||||
|
@ -54,9 +76,28 @@ public class PlayerSettings {
|
|||
* Sets the player's name
|
||||
*
|
||||
* @param name
|
||||
* the new name
|
||||
* the new name
|
||||
*/
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the player's TurnControlFactory
|
||||
*
|
||||
* @param turnControlFactory
|
||||
* player's TurnControlFactory
|
||||
*/
|
||||
public void setTurnControlFactory(TurnControlFactory turnControlFactory) {
|
||||
this.turnControlFactory = turnControlFactory;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the player's TurnControlFactory
|
||||
*
|
||||
* @return player's TurnControlFactory
|
||||
*/
|
||||
public TurnControlFactory getTurnControlFactory() {
|
||||
return turnControlFactory;
|
||||
}
|
||||
}
|
||||
|
|
Reference in a new issue