|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectde.htwdd.rosenkoenig.gui.GameLogger
public class GameLogger
"GUI" that logs all actions (log4j level: INFO). Use this class to
| Field Summary | |
|---|---|
private static int |
guiIndex
An index to distinguish different GameLoggers. |
private org.apache.log4j.Logger |
log
log4j logger |
| Constructor Summary | |
|---|---|
GameLogger()
Default constructor: initializes log4j and generates an index for the current GUI |
|
| Method Summary | |
|---|---|
void |
activatePlayer(Color color,
boolean activate)
Activate or deactivate the player's name string. |
void |
cardSelected()
This function is called whenever the player selected a card. |
void |
disablePlayer(Color color)
Disables all controls of a single player. |
void |
drawDeckSelected()
This function is called whenever the player drew a card. |
void |
enableDrawDeck(ImageState state)
Enables / disables the draw deck. |
void |
enableEndTurn(ImageState state)
Enables / disables the GUI element that ends a player's turn |
void |
gameEnded()
This function is called after the game has ended. |
void |
gameStarted()
This function is called upon startup of the game. |
void |
hideScoreChange(Color player)
This method tells the GUI to hide a player's score increase. |
void |
initGUI(Game game,
java.lang.String nameRed,
java.lang.String nameWhite)
Use this method to perform initialization. |
void |
knightsToggled()
This function is called whenever the player's knights have been toggled. |
void |
redrawGUI()
forces the GUI to show all changes taken since the last call of redrawGUI. |
void |
setBoard(Color[][] color)
setBoard is called to replace the complete board. |
void |
setCards(Color color,
java.util.List<Card> cards)
This method is called whenever a player's card deck has changed and sets a player's card deck. |
void |
setCardState(Color color,
ImageState state,
int card,
boolean knightable)
setCardState is called whenever a card's state has changed. |
void |
setCrown(Position position)
This method is called to specify the position of the crown on the board. |
void |
setDrawDeck(int number)
Sets the number of cards left in the draw deck. |
void |
setKnights(Color color,
int number)
Sets the number of knights a player has left. |
void |
setKnightState(Color color,
ImageState state)
This method is called whenever a player's knights are enabled or disabled. |
void |
setPlayedDeck(int number,
Card playedCard)
Sets the number of cards left in the played cards deck. |
void |
setScore(Color color,
int score)
Updates a player's score. |
void |
setScoreChange(Color color,
int score)
After the player selects the card he wants to play, the GUI shows the possible score increase. |
void |
setStone(Color color,
Position position,
boolean perhaps)
Sets a stone on the board. |
void |
turnEnded()
This function is called whenever a player's turn has ended i.e. the user clicked the OK button. |
void |
turnStarted()
This function is called whenever a player's turn has started. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
private static int guiIndex
private org.apache.log4j.Logger log
| Constructor Detail |
|---|
public GameLogger()
| Method Detail |
|---|
public void redrawGUI()
redrawGUI in interface GUI
public void setCards(Color color,
java.util.List<Card> cards)
setCards in interface GUIcolor - playercards - card deck (up to five cards)
public void setCardState(Color color,
ImageState state,
int card,
boolean knightable)
setCardState in interface GUIcolor - playerstate - enabled, disabled, selectedcard - index of the card that will be changedknightable - if set to true, the selected card is marked knightable
public void setStone(Color color,
Position position,
boolean perhaps)
setStone in interface GUIcolor - color of the stone or null to remove the stoneposition - the stone's positionperhaps - if set to true, the stone is drawn "misty"public void setBoard(Color[][] color)
setBoard in interface GUIcolor - array (dimensions habe to be 9x9) of stones. A color represents a stone, null
represents an empty field
public void setKnights(Color color,
int number)
setKnights in interface GUIcolor - playernumber - number of knights left
public void setKnightState(Color color,
ImageState state)
setKnightState in interface GUIcolor - playerstate - enabled, disabled
public void setScore(Color color,
int score)
setScore in interface GUIcolor - playerscore - new scorepublic void disablePlayer(Color color)
disablePlayer in interface GUIcolor - player
public void activatePlayer(Color color,
boolean activate)
activatePlayer in interface GUIcolor - the player's coloractivate - whether to activate the player or not
public void setScoreChange(Color color,
int score)
setScoreChange in interface GUIcolor - playerscore - score increasepublic void setDrawDeck(int number)
setDrawDeck in interface GUInumber - number of cards left
public void setPlayedDeck(int number,
Card playedCard)
setPlayedDeck in interface GUInumber - number of cards leftplayedCard - the card that was played lastpublic void enableDrawDeck(ImageState state)
enableDrawDeck in interface GUIstate - enabled or disabledpublic void enableEndTurn(ImageState state)
enableEndTurn in interface GUIstate - enabled or disabledpublic void hideScoreChange(Color player)
hideScoreChange in interface GUIplayer - the player whose score increase is to be hidden
public void initGUI(Game game,
java.lang.String nameRed,
java.lang.String nameWhite)
initGUI in interface GUIgame - the game this GUI belongs tonameRed - the red player's namenameWhite - the white player's nameGamepublic void setCrown(Position position)
setCrown in interface GUIposition - the crown's positionpublic void drawDeckSelected()
drawDeckSelected in interface GameObserverpublic void cardSelected()
cardSelected in interface GameObserverpublic void gameEnded()
gameEnded in interface GameObserverpublic void gameStarted()
gameStarted in interface GameObserverpublic void knightsToggled()
knightsToggled in interface GameObserverpublic void turnEnded()
turnEnded in interface GameObserverpublic void turnStarted()
turnStarted in interface GameObserver
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||