pictionary.pictionaryclient
Interface IPictionaryClientCallback

All Known Implementing Classes:
PictionaryClientGUI

public interface IPictionaryClientCallback

An interface defining the methods which an pictionary client should implement, these methods are called by PictionaryClient and implemented by PictionaryClientGUI.

Author:
Kristoffer Nordkvist

Method Summary
 void aClientConnected(java.lang.String client)
          This method is called when a new client has connected to the server.
 void aClientDisconnected(java.lang.String client)
          This method is called when a client has disconnected from the server.
 void clientBroadcastMessageReceived(java.lang.String client, java.lang.String message)
          This method is called when a message from a client, broadcasted to all other clients, is received.
 void clientStartedDrawing(java.lang.String client)
          This method is called when a client has started drawing.
 void closedByError(java.lang.String error)
          This method is called when the connection to the server has been closed.
 void connectedToServer()
          This method is called when the player successfully connected to a server.
 void correctGuess()
          This method is called when the player has made a correct guess.
 void correctGuessBroadcastReceived(java.lang.String player, java.lang.String guess)
          This method is called to notify the client that a player made a correct guess.
 void drawReceived(java.awt.Point point)
          This method is called to notify the client that the drawing player drew at a specific point.
 void joinedNewGame(java.util.List<java.lang.String> players, int gameStatus)
          This method is called when the client successfully joined a game of Pictionary.
 void serverDisconnected()
          This method is called when the connection to the server is lost.
 void serverMessageReceived(java.lang.String message)
          This method is called when a message from the server sent to all the clients is received.
 void startDrawing(java.lang.String wordToDraw, int timeLimit)
          This method is called when the player should start drawing a word.
 void startGuessing()
          This method is called to notify the client that a player is drawing and that the client can start making guesses.
 void stopDrawing()
          This method is called to notify the client that it should stop drawing.
 void stopGuessing()
          This method is called to notify the client that it should stop guessing, for example when someone made a correct guess or when the drawing player's time is up.
 java.lang.String userNameRequest()
          This method is called when the server has requested the client to respond with an username.
 void wrongGuessBroadcastReceived(java.lang.String player, java.lang.String guess)
          This method notifies the client that a player made an incorrect guess.
 

Method Detail

serverMessageReceived

void serverMessageReceived(java.lang.String message)
This method is called when a message from the server sent to all the clients is received.

Parameters:
message - The Message sent from the server.

clientBroadcastMessageReceived

void clientBroadcastMessageReceived(java.lang.String client,
                                    java.lang.String message)
This method is called when a message from a client, broadcasted to all other clients, is received.

Parameters:
client - The name of the client that sent the message.
message - The Message sent from

aClientConnected

void aClientConnected(java.lang.String client)
This method is called when a new client has connected to the server.

Parameters:
client - The name of the new client that connected.

aClientDisconnected

void aClientDisconnected(java.lang.String client)
This method is called when a client has disconnected from the server.

Parameters:
client - The name of the client that disconnected.

joinedNewGame

void joinedNewGame(java.util.List<java.lang.String> players,
                   int gameStatus)
This method is called when the client successfully joined a game of Pictionary.

Parameters:
players - All the players participating in the game.
gameStatus - The status of the game, equal to a status int in PictionaryGame.

startDrawing

void startDrawing(java.lang.String wordToDraw,
                  int timeLimit)
This method is called when the player should start drawing a word.

Parameters:
wordToDraw - The word that the player should attempt to draw.
timeLimit - The amount of time, in seconds, the player can draw before his time is up.

serverDisconnected

void serverDisconnected()
This method is called when the connection to the server is lost.


drawReceived

void drawReceived(java.awt.Point point)
This method is called to notify the client that the drawing player drew at a specific point.

Parameters:
point - A Point containing the coordinates that were filled.

stopDrawing

void stopDrawing()
This method is called to notify the client that it should stop drawing.
This could happen when the draw time is up or when a player made a correct guess.


startGuessing

void startGuessing()
This method is called to notify the client that a player is drawing and that the client can start making guesses.


stopGuessing

void stopGuessing()
This method is called to notify the client that it should stop guessing, for example when someone made a correct guess or when the drawing player's time is up.


correctGuessBroadcastReceived

void correctGuessBroadcastReceived(java.lang.String player,
                                   java.lang.String guess)
This method is called to notify the client that a player made a correct guess.

Parameters:
player - The name of the player that made the correct guess.
guess - The guess that was made.

correctGuess

void correctGuess()
This method is called when the player has made a correct guess.


wrongGuessBroadcastReceived

void wrongGuessBroadcastReceived(java.lang.String player,
                                 java.lang.String guess)
This method notifies the client that a player made an incorrect guess.

Parameters:
player - The name of the player that made the incorrect guess.
guess - The incorrect guess.

connectedToServer

void connectedToServer()
This method is called when the player successfully connected to a server.


userNameRequest

java.lang.String userNameRequest()
This method is called when the server has requested the client to respond with an username.
This method will be called until the server has accepted the username.

Returns:
Returns The username that will identify this client, and will be seen by the other connected clients.

clientStartedDrawing

void clientStartedDrawing(java.lang.String client)
This method is called when a client has started drawing.

Parameters:
client - The name of the client that started drawing.

closedByError

void closedByError(java.lang.String error)
This method is called when the connection to the server has been closed.

Parameters:
error - A description of the cause to the error.