de.htwdd.rosenkoenig.game
Interface GameObserver

All Known Implementing Classes:
GameLogger, PatternCreator

public interface GameObserver

This interface can be used to observe the game (hence the name). Classes implementing this interface can choose different reactions on the actions taken by the user. The types of actions are explained below.


Method Summary
 void cardSelected()
          This function is called whenever the player selected a card.
 void drawDeckSelected()
          This function is called whenever the player drew a card.
 void gameEnded()
          This function is called after the game has ended.
 void gameStarted()
          This function is called upon startup of the game.
 void knightsToggled()
          This function is called whenever the player's knights have been toggled.
 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.
 

Method Detail

gameStarted

void gameStarted()
This function is called upon startup of the game.


gameEnded

void gameEnded()
This function is called after the game has ended. You can use this function for example to store a user's high score.


cardSelected

void cardSelected()
This function is called whenever the player selected a card. You can use Game.getNextCard() to obtain the card selected by the user. Use this function to persist the information about the player's played card.


drawDeckSelected

void drawDeckSelected()
This function is called whenever the player drew a card. The drawn card is the last card in the user's card set (the ArrayList cards).


knightsToggled

void knightsToggled()
This function is called whenever the player's knights have been toggled. It does not imply that the user played a card using the knight. It just informs that the knights were (de)selected.


turnEnded

void turnEnded()
This function is called whenever a player's turn has ended i.e. the user clicked the OK button. The Player's getter can then be used to retreive the required information about the game and the players. Information about the card played by the user (if he/she played or drew) cannot be obtained at this point. These information must be persisted in functions like knightsToggled or cardSelected.


turnStarted

void turnStarted()
This function is called whenever a player's turn has started.