de.jadv.client
Class JAdvClient

java.lang.Object
  |
  +--de.jadv.client.JAdvClient

public class JAdvClient
extends java.lang.Object

Author:
neitzel, jbisso

Field Summary
private  GameData _gameData
           
private  GameWindow _gameWindow
           
private  SyncByteBuffersForChannels _ioBuffer
           
private  SocketThread _ioThread
           
static java.util.logging.Logger logger
          The logger that the entire client uses.
private  boolean redrawWindow
           
 
Constructor Summary
JAdvClient()
           
 
Method Summary
 boolean connect(java.lang.String host, int port)
          Connect JAdvClient to the Proxy if we are not connected already.
 JAdvEvent decodeEvent()
           
 void doCommand(java.lang.String command)
           
 GameData getGameData()
           
 SocketThread getIOThread()
           
 void handleEvent(JAdvEvent event)
          Handle the specified Event.
 boolean login(java.lang.String username, java.lang.String password)
          Logs an existing player in.
static void main(java.lang.String[] args)
           
 void move(int direction)
          Moves the player into a direction.
 int receiveData(java.nio.channels.SocketChannel sChannel)
           
 boolean registerNewPlayer(java.lang.String[] newPlayerAttributes)
          Registers a new player with the server.
private  void requestAvailableRaces()
           
 int sendData(java.nio.channels.SocketChannel sChannel)
           
 void sendEvent(JAdvEvent event)
           
 void setGameWindow(GameWindow gameWindow)
           
 void setIOThread(SocketThread ioThread)
           
 void stop(int errcode)
          Exit sthe client application.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

public static java.util.logging.Logger logger
The logger that the entire client uses.


_gameWindow

private GameWindow _gameWindow

_gameData

private GameData _gameData

_ioThread

private SocketThread _ioThread

_ioBuffer

private SyncByteBuffersForChannels _ioBuffer

redrawWindow

private boolean redrawWindow
Constructor Detail

JAdvClient

public JAdvClient()
Method Detail

main

public static void main(java.lang.String[] args)

setGameWindow

public void setGameWindow(GameWindow gameWindow)

getGameData

public GameData getGameData()

setIOThread

public void setIOThread(SocketThread ioThread)

getIOThread

public SocketThread getIOThread()

receiveData

public int receiveData(java.nio.channels.SocketChannel sChannel)
                throws java.io.IOException
java.io.IOException

sendData

public int sendData(java.nio.channels.SocketChannel sChannel)
             throws java.io.IOException
java.io.IOException

sendEvent

public void sendEvent(JAdvEvent event)

decodeEvent

public JAdvEvent decodeEvent()

connect

public boolean connect(java.lang.String host,
                       int port)
Connect JAdvClient to the Proxy if we are not connected already.

Parameters:
host - the proxy to connect to
port - the port to connect to the proxy on
Returns:
whether the method succeeds or not

registerNewPlayer

public boolean registerNewPlayer(java.lang.String[] newPlayerAttributes)
Registers a new player with the server.


login

public boolean login(java.lang.String username,
                     java.lang.String password)
Logs an existing player in.


stop

public void stop(int errcode)
Exit sthe client application.


move

public void move(int direction)
Moves the player into a direction.


doCommand

public void doCommand(java.lang.String command)

handleEvent

public void handleEvent(JAdvEvent event)
Handle the specified Event.


requestAvailableRaces

private void requestAvailableRaces()