|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.sun.kjava.Spotlet | +--monrovia.client.MonroviaClient
This is the main class of the client application and user interface. It handles the game events and initializes other user interface classes. The class initializes the other user interface objects based on the default values set in the class. If some other window is opened, leave that window do all the event handling until closed. MonroviaClient implements a couple of interfaces which are used by the menu and the dialogs. It contains also the interface which is used by the clientside protocol.
Fields inherited from class com.sun.kjava.Spotlet |
CALCICON, KEY_HARD1, KEY_HARD2, KEY_HARD3, KEY_HARD4, KEY_POWER, MENUICON, NO_EVENT_OPTIONS, PAGEDOWN, PAGEUP, WANT_SYSTEM_KEYS |
Constructor Summary | |
MonroviaClient()
Constructor for the Spotlet class. |
Method Summary | |
void |
arena(short[][] pMapBytes,
short[][] pBitmapBytes,
Command[] pMapCommands,
Stat[] pPlayerStats)
Receives the arena and player information from the protocol. |
void |
changedStat(int pStatID,
int pStatValue)
Gives a new integer value for a named statistics information. |
void |
changedStat(int pStatID,
java.lang.String pStatValue)
Gives a new string value for a named statistics information. |
void |
command(Command pCommand)
adds or removes a command |
void |
connectionError(java.lang.String pMessage)
This indicates that an error occurred while connecting. |
void |
dialogDismissed(java.lang.String pTitle)
This method defines the DialogOwner interface. |
void |
giveSenders(UdpSender pUdpSender,
TcpSender pTcpSender)
Gives the handles for sending data. |
void |
init()
Initializes the stuff we do not want to create before connecting. |
void |
keyDown(int pKeyCode)
This method is invoked if the user presses either of the page up or page down hard keys, taps the calculator or menu icon, or enters a character (e.g. |
static void |
main(java.lang.String[] args)
This is the first function to be executed when starting the code. |
void |
menuClose(org.precipice.kvm.form.Menu pMenu,
org.precipice.kvm.form.MenuItem pItem)
This method is called when the menu is closed. |
void |
newLocation(int pXMap,
int pYMap)
Sets the location of the player in this arena. |
void |
newMessage(java.lang.String pMessage)
Adds a new message to the message window. |
void |
newObject(int pBitmapID,
int pXDelta,
int pYDelta)
Adds new dynamic map object to the map. |
void |
paint(boolean pForce)
Draw the borders, command menu, message window, statistics information and other buttons. |
void |
penDown(int pX,
int pY)
This method is invoked if the user places the pen on the display. |
void |
penMove(int pX,
int pY)
This method is invoked if the user moves the pen over the display. |
void |
refresh()
Tells the client that all the information for this turn has arrived. |
void |
serverExit()
Informs that the server has exited/killed our connection. |
void |
serverReconnect()
Informs that the server wishes to reconnect the TCP connection for example when changing the arena. |
Methods inherited from class com.sun.kjava.Spotlet |
beamReceive, beamSend, dispatch, getFlashID, penUp, register, setPalmEventOptions, unknownEvent, unregister |
Methods inherited from class java.lang.Object |
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
public MonroviaClient()
Method Detail |
public void paint(boolean pForce)
pForce
- true if we want to paint even if nothing was changed,
false otherwisepublic void dialogDismissed(java.lang.String pTitle)
dialogDismissed
in interface com.sun.kjava.DialogOwner
pTitle
- the name of the dialog that was closedpublic void menuClose(org.precipice.kvm.form.Menu pMenu, org.precipice.kvm.form.MenuItem pItem)
menuClose
in interface org.precipice.kvm.form.MenuOwner
pMenu
- handle to the menupItem
- handle to the menu itempublic void init()
public void penDown(int pX, int pY)
penDown
in class com.sun.kjava.Spotlet
pX
- the x coordinate of the point at which the pen was placedpY
- the y coordinate of the point at which the pen was placedpublic void penMove(int pX, int pY)
penMove
in class com.sun.kjava.Spotlet
pX
- the x coordinate of the destination point of the movepY
- the y coordinate of the destination point of the movepublic void keyDown(int pKeyCode)
keyDown
in class com.sun.kjava.Spotlet
pKeyCode
- the code of the key the user enteredpublic static void main(java.lang.String[] args)
public void giveSenders(UdpSender pUdpSender, TcpSender pTcpSender)
giveSenders
in interface ClientProtocolHandler
pUdpSender
- handle for sending UDP datapTcpSender
- handle for sending TCP datapublic void arena(short[][] pMapBytes, short[][] pBitmapBytes, Command[] pMapCommands, Stat[] pPlayerStats)
arena
in interface ClientProtocolHandler
pMapBytes
- map structure for this arenapBitmapBytes
- bitmaps used in this arenapMapCommands
- commandspPlayerStats
- player statistics informationpublic void serverExit()
serverExit
in interface ClientProtocolHandler
public void refresh()
refresh
in interface ClientProtocolHandler
public void serverReconnect()
serverReconnect
in interface ClientProtocolHandler
public void newLocation(int pXMap, int pYMap)
newLocation
in interface ClientProtocolHandler
pXMap
- the X coordinate on the mappYMap
- the Y coordinate on the mappublic void changedStat(int pStatID, int pStatValue)
changedStat
in interface ClientProtocolHandler
pStatID
- the ID of the statistics info to be setpStatValue
- the value that the statistics info should be set
topublic void changedStat(int pStatID, java.lang.String pStatValue)
changedStat
in interface ClientProtocolHandler
pStatID
- the ID of the statistics info to be setpStatValue
- the value that the statistics info should be set
topublic void command(Command pCommand)
command
in interface ClientProtocolHandler
pCommand
- the command objectpublic void newMessage(java.lang.String pMessage)
newMessage
in interface ClientProtocolHandler
pMessage
- the message stringpublic void newObject(int pBitmapID, int pXDelta, int pYDelta)
newObject
in interface ClientProtocolHandler
pBitmapID
- the ID of the bitmap to be displayedpXDelta
- the X distance from the playerpYDelta
- the Y distance from the playerpublic void connectionError(java.lang.String pMessage)
connectionError
in interface ClientProtocolHandler
pMessage
- the description of the error
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |