All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class game.ClientGame

java.lang.Object
   |
   +----game.ClientGame

public abstract class ClientGame
extends Object
implements GameLinkListener
The ClientGame class (not to be confused with GameClient) is the abstract class specifying what features a game that will be handled by the Jags client needs to provide.

[DESCRIBE ME MORE]


Variable Index

 o debug
if true, enables the printing of debug informations on the console.
 o gameLink
The GameLinkFilter object used to communicate with the Jags server.
 o id
The id of this game.
 o jframe
The window of this game.
 o jframe2
The window for the players - should be removed.
 o menuBar
The default menu bar.
 o myPlayerId
Id of the player we're actually playing with.
 o myThis
 o name
The name of this game.
 o players
[DESCRIBE ME]
 o playersPanel
The Panel containing the players component

Constructor Index

 o ClientGame()
Creates a new ClientGame [DESCRIBE ME MORE]
 o ClientGame(GameLinkFilter)
Creates a new ClientGame [DESCRIBE ME MORE]

Method Index

 o addPlayer(Player)
Adds the given player to this game, as ordered by the server.
 o createMenuBar()
Creates the Menu Bar.
 o createPlayer(int, Object)
Creates a new particular Player for this game.
 o createWindow(int, int)
Creates a 'default' window containing menus, toolbar, players and a panel that can receive the game components.
 o doCloseGame()
Closes the game (and notifies the server)
 o frameReceived(Object, LinkFrame)
 o getComponent()
Returns the GUI component which is the graphical interface of the game.
 o getId()
Returns the id of the game.
 o getMenuBar()
Returns the default menu bar.
 o getMyPlayerId()
Returns the id of the player we're actually playing with.
 o getPlayer(int)
 o getPlayersPanel()
Returns the default playersPanel
 o make(GameLinkFilter, int)
Used as a substitution of the constructor which cannot be called with parameters in a call to java.lang.Class.newInstance().
 o removePlayer(Player)
Removes the player from this game, as ordered by the server.
 o setId(Object)
Sets the id of the game.
 o setName(String)
Sets the name of this game.

Variables

 o gameLink
 protected GameLinkFilter gameLink
The GameLinkFilter object used to communicate with the Jags server.

 o id
 protected Object id
The id of this game.

 o name
 protected String name
The name of this game.

 o debug
 protected boolean debug
if true, enables the printing of debug informations on the console.

 o players
 Hashtable players
[DESCRIBE ME]

 o myThis
 protected ClientGame myThis
 o menuBar
 protected JMenuBar menuBar
The default menu bar.

 o jframe
 protected JFrame jframe
The window of this game.

 o jframe2
 protected JFrame jframe2
The window for the players - should be removed.

 o playersPanel
 protected Container playersPanel
The Panel containing the players component

 o myPlayerId
 protected int myPlayerId
Id of the player we're actually playing with.

Constructors

 o ClientGame
 public ClientGame()
Creates a new ClientGame [DESCRIBE ME MORE]

 o ClientGame
 public ClientGame(GameLinkFilter link)
Creates a new ClientGame [DESCRIBE ME MORE]

Parameters:
link - the GameLinkFilter object used to communicate with the Jags server.

Methods

 o make
 public void make(GameLinkFilter link,
                  int myPlayerId)
Used as a substitution of the constructor which cannot be called with parameters in a call to java.lang.Class.newInstance(). Actually constructs the ClientGame.

Parameters:
link - the link to the game in the server
myPlayerId - the id of the player we're actually playing with.
 o createPlayer
 public abstract Player createPlayer(int id,
                                     Object data)
Creates a new particular Player for this game. This method should be overriden by children so the created player is of the right type. !@param name the name of the new player to create

Parameters:
id - the id of the player, which should have been sent by the server.
object - the data needed to reconstruct the player in the client.
Returns:
the newly created player of the right type to be used in this game.
 o addPlayer
 public void addPlayer(Player player)
Adds the given player to this game, as ordered by the server.

Parameters:
player - the player to add to the game.
 o removePlayer
 public void removePlayer(Player player)
Removes the player from this game, as ordered by the server.

 o getId
 public Object getId()
Returns the id of the game.

 o setId
 public void setId(Object id)
Sets the id of the game.

 o setName
 public void setName(String name)
Sets the name of this game.

 o getMyPlayerId
 public int getMyPlayerId()
Returns the id of the player we're actually playing with.

 o getPlayer
 public Player getPlayer(int id)
 o createWindow
 public Container createWindow(int width,
                               int height)
Creates a 'default' window containing menus, toolbar, players and a panel that can receive the game components. The window is stored and can be retrieved through the getComponent method. The panel is returned.

Parameters:
width - the width of the window
height - the height of the window
Returns:
the panel which can receive the game gui components.
See Also:
getComponent
 o createMenuBar
 public JMenuBar createMenuBar()
Creates the Menu Bar.

 o doCloseGame
 public void doCloseGame()
Closes the game (and notifies the server)

 o getComponent
 public Component getComponent()
Returns the GUI component which is the graphical interface of the game. Typically this component is a JFrame.

Returns:
the gui component beeing the graphical interface of the game.
 o getMenuBar
 public JMenuBar getMenuBar()
Returns the default menu bar.

 o getPlayersPanel
 public Container getPlayersPanel()
Returns the default playersPanel

 o frameReceived
 public void frameReceived(Object link,
                           LinkFrame frame)

All Packages  Class Hierarchy  This Package  Previous  Next  Index