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