Class games.Battle.shared.comm.GameInit
All Packages  Class Hierarchy  This Package  Previous  Next  Index

Class games.Battle.shared.comm.GameInit

java.lang.Object
   |
   +----games.Battle.shared.comm.BattlePacket
           |
           +----games.Battle.shared.comm.GameInit

public class GameInit
extends BattlePacket
A GameInit packet is the information which is sent from the server to each client at the beginning of a game in order to set up preamble information like the Rules of the game, the colors of each of the players.

Variable Index

 o DEFAULT_COLORS
the default colours used by games.

Constructor Index

 o GameInit()
The default constructor which fills the GameInit packet with default data.
 o GameInit(int, Color[])
The data constructor for the GameInit which fills it with the given data.

Method Index

 o fromBytes(byte[])
Fill this GameInit packet with the given array of bytes.
 o getPlayer()
Return the player identifier of this game initializer
 o toBytes()
Produce an array of bytes representing a GameInit

Variables

 o DEFAULT_COLORS
  public final static Color DEFAULT_COLORS[]
the default colours used by games.

Constructors

 o GameInit
  public GameInit()
The default constructor which fills the GameInit packet with default data. This contructor is used by the client application prior to calling the readFrom(is) method to obtain a game init packet from a data stream.
 o GameInit
  public GameInit(int player,
                  Color colors[])
The data constructor for the GameInit which fills it with the given data. This contructor is used by the server application prior to calling the writeTo(os) method to send a game init packet to a data stream.
Parameters:
player - the player identifier
an - array of colors representing the color for each player

Methods

 o getPlayer
  public int getPlayer()
Return the player identifier of this game initializer
 o toBytes
  public byte[] toBytes()
Produce an array of bytes representing a GameInit
Overrides:
toBytes in class BattlePacket
 o fromBytes
  public void fromBytes(byte buffer[])
Fill this GameInit packet with the given array of bytes.
Parameters:
buffer - the byte array from which to fill this GameInit
Overrides:
fromBytes in class BattlePacket

All Packages  Class Hierarchy  This Package  Previous  Next  Index