Class ClientThread

Class ClientThread

java.lang.Object
   |
   +----java.lang.Thread
           |
           +----ClientThread

public class ClientThread
extends Thread
This is the main thread running on each client that has connected to the gameserver. It will open a large frame and handle all interaction with the user as well as the communication with the server.
Version:
2.4
Author:
Torbjörn Nilsson, Nicklas Hjalmarsson

Method Index

 o atoi(String)
Converts a string to an integer if possible, otherwise returns zero.
 o castSpell()
Called from BkgPanel whenever the castspell button is pressed.
 o dragonDualSelect(Event)
Called from the DragonList-class whenever an item is selected TWICE
 o dragonSelect(Event)
Called from the DragonList-class whenever an item is selected once.
 o endOfTurn()
Called from TimerThread when one turn has passed.
 o getDragonImage(Dragon)
 o main(String[])
Start up the ClientThread.
 o mapEvent(int, int)
This method is called from the panel whenever someone has clicked on "the map".
 o message(String)
Prints the given messsage in the top of the textpanel on the frame.
 o run()
This method contains the mainloop of the game on the clientside.
 o setNewScreen(int)
Use this method to switch to another panel/screen.
 o setOwnerColor(Graphics, int)
Set current colour in the given graphics context to a colour depending on the owner of the given city.
 o setupResearchRoom()
 o spellCategorySelect(Event)
Callbacked method when a spell school is selected from the SpellSchoolList
 o spellSchoolSelect(Event)
Callbacked from spellSchoolList when a school has been selected
 o spellSelect(Event)
Callbacked from spellList when a spell has been selected

Methods

 o run
  public void run()
This method contains the mainloop of the game on the clientside. First of all though, initial data is collected from the server.
Overrides:
run in class Thread
 o message
  public void message(String msg)
Prints the given messsage in the top of the textpanel on the frame.
 o atoi
  public int atoi(String s)
Converts a string to an integer if possible, otherwise returns zero.
 o spellSchoolSelect
  public void spellSchoolSelect(Event event)
Callbacked from spellSchoolList when a school has been selected
 o spellSelect
  public void spellSelect(Event event)
Callbacked from spellList when a spell has been selected
 o castSpell
  public void castSpell()
Called from BkgPanel whenever the castspell button is pressed. Dragons and Cities are passed their names, Areas are passed the string "xx+yy" where xx and yy are the coordinates of the area on the map.
 o setOwnerColor
  public void setOwnerColor(Graphics g,
                            int owner)
Set current colour in the given graphics context to a colour depending on the owner of the given city.
 o setupResearchRoom
  public void setupResearchRoom()
 o spellCategorySelect
  public void spellCategorySelect(Event event)
Callbacked method when a spell school is selected from the SpellSchoolList
 o getDragonImage
  public Image getDragonImage(Dragon d)
Returns:
The Image object associated whith the given Dragon object.
 o dragonSelect
  public void dragonSelect(Event event)
Called from the DragonList-class whenever an item is selected once.
 o dragonDualSelect
  public void dragonDualSelect(Event event)
Called from the DragonList-class whenever an item is selected TWICE
 o setNewScreen
  public void setNewScreen(int nr)
Use this method to switch to another panel/screen.
 o endOfTurn
  public void endOfTurn()
Called from TimerThread when one turn has passed. Performs preprocessing before data is sent to server, as well as postprocessing after the new has been collected.
 o mapEvent
  public void mapEvent(int x,
                       int y)
This method is called from the panel whenever someone has clicked on "the map".
 o main
  public static void main(String a[])
Start up the ClientThread. Takes as an argument the name of the host where the StartupServer is running. Uses port 8282 to communicate through.