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.
-
DEFAULT_COLORS
-
the default colours used by games.
-
GameInit()
- The default constructor which fills the GameInit packet with
default data.
-
GameInit(int, Color[])
- The data constructor for the GameInit which fills it with
the given data.
-
fromBytes(byte[])
- Fill this GameInit packet with the given array of bytes.
-
getPlayer()
- Return the player identifier of this game initializer
-
toBytes()
- Produce an array of bytes representing a GameInit
DEFAULT_COLORS
public final static Color DEFAULT_COLORS[]
- the default colours used by games.
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.
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
getPlayer
public int getPlayer()
- Return the player identifier of this game initializer
toBytes
public byte[] toBytes()
- Produce an array of bytes representing a GameInit
- Overrides:
- toBytes in class BattlePacket
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