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]
-
debug
- if true, enables the printing of debug informations on the console.
-
gameLink
- The
GameLinkFilter
object used to communicate with the Jags
server.
-
id
- The id of this game.
-
jframe
- The window of this game.
-
jframe2
- The window for the players - should be removed.
-
menuBar
- The default menu bar.
-
myPlayerId
- Id of the player we're actually playing with.
-
myThis
-
-
name
- The name of this game.
-
players
- [DESCRIBE ME]
-
playersPanel
- The Panel containing the players component
-
ClientGame()
- Creates a new ClientGame [DESCRIBE ME MORE]
-
ClientGame(GameLinkFilter)
- Creates a new ClientGame [DESCRIBE ME MORE]
-
addPlayer(Player)
- Adds the given player to this game, as ordered by the server.
-
createMenuBar()
- Creates the Menu Bar.
-
createPlayer(int, Object)
- Creates a new particular
Player
for this game.
-
createWindow(int, int)
- Creates a 'default' window containing menus, toolbar, players and a panel
that can receive the game components.
-
doCloseGame()
- Closes the game (and notifies the server)
-
frameReceived(Object, LinkFrame)
-
-
getComponent()
- Returns the GUI component which is the graphical interface of the
game.
-
getId()
- Returns the id of the game.
-
getMenuBar()
- Returns the default menu bar.
-
getMyPlayerId()
- Returns the id of the player we're actually playing with.
-
getPlayer(int)
-
-
getPlayersPanel()
- Returns the default playersPanel
-
make(GameLinkFilter, int)
- Used as a substitution of the constructor which cannot be called with parameters
in a call to
java.lang.Class.newInstance()
.
-
removePlayer(Player)
- Removes the player from this game, as ordered by the server.
-
setId(Object)
- Sets the id of the game.
-
setName(String)
- Sets the name of this game.
gameLink
protected GameLinkFilter gameLink
- The
GameLinkFilter
object used to communicate with the Jags
server.
id
protected Object id
- The id of this game.
name
protected String name
- The name of this game.
debug
protected boolean debug
- if true, enables the printing of debug informations on the console.
players
Hashtable players
- [DESCRIBE ME]
myThis
protected ClientGame myThis
menuBar
protected JMenuBar menuBar
- The default menu bar.
jframe
protected JFrame jframe
- The window of this game.
jframe2
protected JFrame jframe2
- The window for the players - should be removed.
playersPanel
protected Container playersPanel
- The Panel containing the players component
myPlayerId
protected int myPlayerId
- Id of the player we're actually playing with.
ClientGame
public ClientGame()
- Creates a new ClientGame [DESCRIBE ME MORE]
ClientGame
public ClientGame(GameLinkFilter link)
- Creates a new ClientGame [DESCRIBE ME MORE]
- Parameters:
- link - the
GameLinkFilter
object used to communicate with
the Jags server.
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.
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.
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.
removePlayer
public void removePlayer(Player player)
- Removes the player from this game, as ordered by the server.
getId
public Object getId()
- Returns the id of the game.
setId
public void setId(Object id)
- Sets the id of the game.
setName
public void setName(String name)
- Sets the name of this game.
getMyPlayerId
public int getMyPlayerId()
- Returns the id of the player we're actually playing with.
getPlayer
public Player getPlayer(int id)
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
createMenuBar
public JMenuBar createMenuBar()
- Creates the Menu Bar.
doCloseGame
public void doCloseGame()
- Closes the game (and notifies the server)
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.
getMenuBar
public JMenuBar getMenuBar()
- Returns the default menu bar.
getPlayersPanel
public Container getPlayersPanel()
- Returns the default playersPanel
frameReceived
public void frameReceived(Object link,
LinkFrame frame)
All Packages Class Hierarchy This Package Previous Next Index