|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.mega.gasp.client.midp.GASPClient
A game client logic running with the MGP must implement this class, MGPClient.
Field Summary | |
protected static javax.microedition.io.HttpConnection |
connection
|
protected CustomTypes |
customTypes
|
private static java.io.DataInputStream |
dis
|
private static java.io.DataOutputStream |
dos
|
private static java.lang.String |
GPServletContainerUrl
|
Constructor Summary | |
GASPClient()
|
Method Summary | |
private static void |
closeAllConnection()
Close all connection streams and the connection. |
protected int |
createAI(int sID,
int minActors,
int maxActors)
Create an public ApplicationInstance. |
protected int |
createAIPriv(int sID,
java.lang.String[] actors,
int minActors,
int maxActors)
Create a private Application Instance with the choosed actors. |
protected void |
endAI(int aSID)
(Try to) End the game if the user is the owner of the application instance. |
private void |
eventsOf(java.io.DataInputStream dis)
Treats the events of the servlet response data input stream. |
protected int |
firstLogin(int applicationID,
java.lang.String username,
java.lang.String password)
This method is called when the user use the application for the first time, e.g when the Actor ID is not present on the client. |
private java.util.Vector |
formLobbyDatas(java.io.DataInputStream dis)
Form the datas contained on the DataInputStream of the lobby servlet response, returns a vector of ApplicationInstanceInfos objects. |
protected java.util.Vector |
getApplicationInstances(int sID)
Returns a stream of game sessions currently available on the Gaming Platform. |
protected void |
getEvents(int aSID)
Provide to get the events in user actorSession on the Platform. |
abstract void |
initCustomTypes()
|
protected int |
joinAI(int sID,
int aIID)
Join the specific ApplicationInstance ID. |
protected int |
joinAIRnd(int sID)
Join randomly an open ApplicationInstance. |
protected int |
login(int aID,
java.lang.String username,
java.lang.String password,
java.lang.String version)
Provide the login on the Gaming Platform, require the correct ActorID, the username and the password, the version of MGIF is optional. |
protected java.lang.String |
name(int aSID,
java.lang.String name)
In game session, this method provides to the user to change his pseudoname. |
abstract void |
onDataEvent(int actorSessionID,
java.util.Hashtable datas)
Method called when a DataEvent is received from the platform. |
abstract void |
onEndEvent(int actorSessionID)
Method called when a EndEvent is received from the platform. |
abstract void |
onJoinEvent(int actorSessionID,
java.lang.String username)
Method called when a JoinEvent is received from the platform. |
abstract void |
onQuitEvent(int actorSessionID)
Method called when a QuitEvent is received from the platform. |
abstract void |
onStartEvent(int actorSessionID)
Method called when a StartEvent is received from the platform. |
protected void |
quit(int sID)
Quit the platform. |
protected void |
quitAI(int aSID)
Quit the ApplicationInstance joined. |
protected void |
sendData(int aSID,
java.util.Hashtable h)
Provide to send in game datas to the Platform. |
private java.io.DataInputStream |
servletRequest(java.lang.String servletName,
java.lang.String formData)
Send a request to the specified servlet with the http post parameters. |
private java.io.DataInputStream |
servletSendDataRequest(java.lang.String servletName,
int aSID,
java.util.Hashtable h)
Send the data in the hashtable to the specified servlet. |
protected boolean |
startAI(int aSID)
(Try to) Start the game if the user is the owner of the application instance. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
private static java.lang.String GPServletContainerUrl
protected CustomTypes customTypes
protected static javax.microedition.io.HttpConnection connection
private static java.io.DataOutputStream dos
private static java.io.DataInputStream dis
Constructor Detail |
public GASPClient()
Method Detail |
public abstract void initCustomTypes()
protected int firstLogin(int applicationID, java.lang.String username, java.lang.String password)
applicationID
- the ID of the applicationusername
- the username wanted by the userpassword
- the password wanted by the user
protected int login(int aID, java.lang.String username, java.lang.String password, java.lang.String version)
aID
- the Actor ID of the user stored on the mobileusername
- the username choosed at the first loginpassword
- the password chooset at the first loginversion
- MGIF compliant version
protected java.util.Vector getApplicationInstances(int sID)
sID
- the Session ID of the user
private java.util.Vector formLobbyDatas(java.io.DataInputStream dis) throws java.io.IOException
java.io.IOException
protected int joinAI(int sID, int aIID)
sID
- the Session ID of the useraIID
- the ApplicationInstance ID choosed
protected int joinAIRnd(int sID)
sID
- the Session ID of the user
protected int createAI(int sID, int minActors, int maxActors)
sID
- the Session ID of the userminActors
- the minimum number of actors required to startmaxActors
- the maximum number of actors
protected int createAIPriv(int sID, java.lang.String[] actors, int minActors, int maxActors)
sID
- the Session ID of the useractors
- the table of ActorID representing the actors accepted in the game sessionminActors
- the minimum number of actors required to startmaxActors
- the maximum number of actors
protected void getEvents(int aSID)
aSID
- the ActorSession ID
protected java.lang.String name(int aSID, java.lang.String name)
aSID
-
protected boolean startAI(int aSID)
aSID
-
protected void endAI(int aSID)
aSID
- protected void quitAI(int aSID)
aSID
- the ActorSession IDprotected void sendData(int aSID, java.util.Hashtable h)
aSID
- the ActorSession IDh
- the hashtable of datas
private void eventsOf(java.io.DataInputStream dis) throws java.io.IOException
dis
- the data input strem
java.io.IOException
protected void quit(int sID)
sID
- the Session ID of the userprivate java.io.DataInputStream servletRequest(java.lang.String servletName, java.lang.String formData) throws java.io.IOException
servletName
- the name of the servletformData
- the HTTP post parameters
java.io.IOException
private java.io.DataInputStream servletSendDataRequest(java.lang.String servletName, int aSID, java.util.Hashtable h) throws java.io.IOException
servletName
- the name of the servlet
java.io.IOException
private static void closeAllConnection()
public abstract void onJoinEvent(int actorSessionID, java.lang.String username)
actorSessionID
- username
- public abstract void onStartEvent(int actorSessionID)
actorSessionID
- public abstract void onEndEvent(int actorSessionID)
actorSessionID
- public abstract void onQuitEvent(int actorSessionID)
actorSessionID
- public abstract void onDataEvent(int actorSessionID, java.util.Hashtable datas)
actorSessionID
- datas
- the hashtable of datas
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |