GLLib: XPlayer Class Reference

GLLib

XPlayer Class Reference
[XPlayer core]

List of all members.

Public Member Functions

void addByte (byte data) throws Exception
 Multiplayer Specific - Add a byte to the current packet.
void addByteArray (byte size, int dataOffset, byte[] data) throws Exception
 Multiplayer Specific - Add a byte array to the current packet.
void addInt (int data) throws Exception
 Multiplayer Specific - Add an int to the current packet.
void addMultipleScoreEntry (int score, int level, int scoreType)
 Adds one score for one level with no supplemental data to the multiple scores buffer for multiple scores sending.
void addMultipleScoreEntryWithSupplementalData (int score, int level, int scoreType, int[] supplemental_data)
 Adds one score for one level with supplemental data to the multiple scores buffer for multiple scores sending.
void addShort (short data) throws Exception
 Multiplayer Specific - Add a short to the current packet.
void addString (String data) throws Exception
 Multiplayer Specific - Add a string array to the current packet.
void cancel ()
 Cancels the ongoing request.
void cleanup ()
 Cleans up the memory allocated during the last server request.
void clearData ()
 Multiplayer Specific - Clears the data for the current processing packet.
byte getByte () throws Exception
 Multiplayer Specific - Get a byte from the current packet.
byte[] getByteArray (int dataOffset, byte[] datadest) throws Exception
 Multiplayer Specific - Get a byte array from the current packet, with offset.
byte[] getByteArray () throws Exception
 Multiplayer Specific - Get a byte array from the current packet.
byte[] getByteDataList ()
 Multiplayer Specific - Get the list of specific byte data for the items hold in the internal buffers in certain multiplayer states.
int getCurrentPlayerLeaderboardPosition ()
 Gets this user's position from the currently accessed leaderboard.
int getCurrentPlayerLeaderboardScore ()
 Gets this user's score from the currently accessed leaderboard.
int[] getCurrentPlayerLeaderboardScoreData ()
 Gets this user's supplemental data from the currently accessed leaderboard.
byte[] getData ()
 Multiplayer Specific - Gets the data for the current processing packet.
String[] getDataList ()
 Multiplayer Specific - Get the list of specific binary data for the items hold in the internal buffers in certain multiplayer states.
int getFirstSessionIndex ()
 Multiplayer Specific - Get the index of the first session on the multiplayer server, retrieved by the list session command.
String getFoundPlayerName ()
 Multiplayer Specific - Get the name of the searched player, after a search operation has returned and was handeled with mpHandleFindPlayer().
String getFoundPlayerSessionName ()
 Multiplayer Specific - Get the name of the session the searched player is in, if any, after a search operation has returned and was handeled with mpHandleFindPlayer().
byte getFoundPlayerSessionNumberOfPlayers ()
 Multiplayer Specific - Get the number of players of the session the searched player is in, if any, after a search operation has returned and was handeled with mpHandleFindPlayer().
byte getFoundPlayerStatus ()
 Multiplayer Specific - Get the status of the searched player, after a search operation has returned and was handeled with mpHandleFindPlayer().
int getInt () throws Exception
 Multiplayer Specific - Get an int from the current packet.
int getLastError ()
 Gets the status of the last request.
boolean getLeaderboardData (String[] names, int[] positions, int[] scores, int[][] scoreDatas)
 Get all the leaderboard data in a single request.
String getLeaderboardEntryPlayerName (int index)
 Gets the name for the player at index in the server returned leaderboard player list.
int getLeaderboardEntryPlayerPosition (int index)
 Gets the ranking of the player at index in the server returned leaderboard player list.
int getLeaderboardEntryPlayerScore (int index)
 Gets the score of the player at index in the server returned leaderboard player list.
int[] getLeaderboardEntryPlayerScoreData (int index)
 Gets the supplemental data for the player at index in the server returned leaderboard player list.
int getLeaderboardSize ()
 Gets the leaderboard size for the currently accessed leaderboard list.
int getLength ()
 Multiplayer Specific - Get the data length for the current processing packet.
int getMyAvgScore ()
 M7 Specific - Gets the user's average score.
int getMyBestRank ()
 M7 Specific - Returns the user's highest ever rank.
int getMyHighScore ()
 M7 Specific - Gets the user's best score.
int[] getMyHighScoreData ()
 M7 Specific - Gets the user's highest score's supplemental data.
String getMyLastTimePlayed ()
 M7 Specific - Gets the date and time the user last played.
int getMyLowScore ()
 M7 Specific - Gets the user's lowest score.
int[] getMyLowScoreData ()
 M7 Specific - Gets the user's lowest score's supplemental data.
int getMyNumberOfGamesPlayed ()
 M7 Specific - Gets the number of times the user has played the game.
String[] getNameList ()
 Multiplayer Specific - Get the names list of the items hold in the internal buffers in certain multiplayer states.
int getNewRankAfterScoreSending ()
 Returns the player's new rank after a score is sent.
int getNumberOfItems ()
 Multiplayer Specific - Get the number of sessions retrieved by the list session command.
void getPlayerStats (int[] bestRankArr, int[] highScoreArr, int[] lowScoreArr, int[] avgScoreArr, int[] numberOfGamesPlayerdArr, String[] lastTimePlayedArr, int[] lowScoreDataArr, int[] highScoreDataArr)
 M7 Specific - Get all the player states in a single request, previously requested from the server using the sendStatsGet and handleStatsGet functions.
String getRequestedPlayerData ()
 Multiplayer Specific - the data for the player whose specific data was requested using mpSendGetPlayerData() and mpHandleGetPlayerData().
String getRequestedPlayerNickname ()
 Multiplayer Specific - the nickname for the player whose specific data was requested using mpSendGetPlayerData() and mpHandleGetPlayerData().
String getSessionData ()
 Multiplayer Specific - Get the speficic game data for the session the player is currently in.
String getSessionName ()
 Multiplayer Specific - Get the name of the session the player is currently in.
short getShort () throws Exception
 Multiplayer Specific - Get a short from the current packet.
String getString () throws Exception
 Multiplayer Specific - Get a string from the current packet.
String getUsername ()
 Fetches the current username.
void handleChangeUsername ()
 Handles the login or registration requests, after such a request has been initiated with sendChangeUsername(), this function's asynchronous pair.
void handleHighscore ()
 Handles the score uploading request, after such a request has been initiated with either sendHighscore(), sendHighscoreWithSupplementalData() or sendMultipleHighscores(), this function's asynchronous pairs.
void handleLogin ()
 Handles the login or registration requests, after such a request has been initiated with sendLogin(), this function's asynchronous pair.
void handleRankGet ()
 Handles the leaderboard request, after such a request has been initiated with sendRankGet, this function's asynchronous pair.
void handleRankGetAroundPlayer ()
 Handles the request for getting the leaderboard entries around the user's rank, after such a request has been initiated with sendRankGetAroundPlayer(), this function's asynchronous pair.
void handleRateGame ()
 M7 Specific - Handles the rate game request, after such a request has been initiated with sendRateGame, this function's asynchronous pair.
void handleRecommendGame ()
 M7 Specific - Handles the recommend game request, after such a request has been initiated with sendRecommendGame, this function's asynchronous pair.
void handleStatsGet ()
 M7 Specific - Handles the request for the user's stats, after such a request has been initiated with sendStatsGet(), this function's asynchronous pair.
void initMultipleScores ()
 Initialises the multiple scores buffer for multiple score sending.
boolean isLoggedIn ()
 Provides information on wether the user has logged or registered on the server yet.
void mpDisconnect ()
 Multiplayer Specific - Finishes the connection with the multiplayer server.
void mpHandleCreateSession ()
 Multiplayer Specific - Handles the create game session request, after such request has been initiated with mpSendCreateSession, this function's asynchronous pair.
void mpHandleDisconnect ()
 Multiplayer Specific - Handles the disconnect request, after such request has been initiated with mpSendDisconnect, this function's asynchronous pair.
void mpHandleEstablishConnection ()
 Multiplayer Specific - Handles the connection establish request, after such request has been initiated with mpSendEstablishConnection, this function's asynchronous pair.
void mpHandleFindPlayer ()
 Multiplayer Specific - Handles the get player info request, after such request has been initiated with mpSendFindPlayer(), this function's asynchronous pair.
void mpHandleFinishGame ()
 Multiplayer Specific - Handles the finish game request, after such request has been initiated with mpSendFinishGame(), this function's asynchronous pair.
void mpHandleGameData () throws Exception
 Multiplayer Specific - receives a game data package, used for in game messages.
void mpHandleGetPlayerData ()
 Multiplayer Specific - Handles the get player info request, after such request has been initiated with mpSendGetPlayerData(), this function's asynchronous pair.
void mpHandleJoinSession ()
 Multiplayer Specific - Handles the join game session request, after such request has been initiated with mpSendJoinSession, this function's asynchronous pair.
void mpHandleKickOutPlayer (String name)
 Multiplayer Specific - Handles the kick out player request, after such request has been initiated with mpSendKickOutPlayer(), this function's asynchronous pair.
void mpHandleLeaveSession ()
 Multiplayer Specific - Handles the leave game session request, after such request has been initiated with mpSendLeaveSession, this function's asynchronous pair.
void mpHandleListSession ()
 Multiplayer Specific - Handles the list session request, after such request has been initiated with mpSendListSession, this function's asynchronous pair.
void mpHandleLogin ()
 Multiplayer Specific - Handles the login request, after such request has been initiated with mpSendLogin, this function's asynchronous pair.
void mpHandleStartGame ()
 Multiplayer Specific - Handles the start game request, after such request has been initiated with mpSendStartGame(), this function's asynchronous pair.
void mpHandleUpdates ()
 Multiplayer Specific - Handles the messages received from server without a previous request - push and in game messages.
final boolean mpHasOpponnentFinished ()
 Multiplayer Specific - Test if the the opponent has finished the game.
final boolean mpIsConnected ()
 Multiplayer Specific - Test if the player is connected to the multiplayer server.
final boolean mpIsInGame ()
 Multiplayer Specific - Test if the player is in a playing a game on the multiplayer server.
final boolean mpIsInSession ()
 Multiplayer Specific - Test if the player is in a game session on the multiplayer server.
final boolean mpIsLoggedIn ()
 Multiplayer Specific - Test if the player is logged on the multiplayer server.
final boolean mpIsMaster ()
 Multiplayer Specific - Test if the player is in a master in a session on the multiplayer server.
void mpPrepareGameData () throws Exception
 Multiplayer Specific - Initialize a game data package, used for in game messages.
void mpSendCreateSession (String sessionname, String sessiondata)
 Multiplayer Specific - Create a new game on the multiplayer server.
void mpSendDisconnect ()
 Multiplayer Specific - Send a disconnect request to the multiplayer server.
void mpSendEstablishConnection ()
 Multiplayer Specific - Send an connection establish messages to the server.
void mpSendFindPlayer (String playerName)
 Multiplayer Specific - get info for a player - status, current game.
void mpSendFinishGame ()
 Multiplayer Specific - Finish the game.
void mpSendGameData ()
 Multiplayer Specific - Send a game data package, used for in game messages.
void mpSendGetPlayerData (String playerName)
 Multiplayer Specific - Get the player specific data for a specified player.
void mpSendJoinSession (String sessionname)
 Multiplayer Specific - Join a game session on the multiplayer server.
void mpSendKickOutPlayer (String playerName)
 Multiplayer Specific - Kick out a player.
void mpSendLeaveSession ()
 Multiplayer Specific - Leave a game session.
void mpSendListSession (byte numberOfSessions, byte firstSessionIndex)
 Multiplayer Specific - Send a list available games request to the server.
void mpSendLogin (String player_data)
 Multiplayer Specific - Send a login request to the server.
void mpSendLogin ()
 Multiplayer Specific - Send a login request to the server.
void mpSendQuickGame ()
 Multiplayer Specific - Send a quick game request to the server.
void mpSendStartGame ()
 Multiplayer Specific - Start the game.
void sendChangeUsername ()
 Starts a request for changing username.
void sendHighscore (int score, int level, int scoreType)
 Uploads one score for one level on the server, if the level has no supplemental data.
void sendHighscoreWithSupplementalData (int score, int level, int scoreType, int[] supplemental_data)
 Uploads one score for one level on the server, with the supplemental data associated.
void sendLogin (String playerData)
 Starts a request for either registration or login.
void sendMultipleHighscores ()
 Uploads the scores stored in the multiple score buffer on the server.
void sendRankGet (int level, int number_of_players, int scoreType, int numberOfSupplementalDataFields)
 Starts a request for one leaderboard.
void sendRankGetAroundPlayer (int level, int number_of_players_around, int scoreType, int numberOfSupplementalDataFields)
 Starts a request for getting the scores of players ranked around the user's current standing in a leaderboard.
void sendRateGame (int rating)
 M7 Specific - Sends a request for rating the game.
void sendRecommendGame ()
 M7 Specific - Sends a request for recommending the game.
void sendStatsGet (int level, int numberOfSupplementalDataFields)
 M7 Specific - Sends a request for the user's stats for a certain level.
void setData (byte[] data)
 Multiplayer Specific - Sets the data for the current processing packet.
void setPhoneNumber (String phoneNr)
 M7 Specific - Registers the phone number associated with the player's account.
void setUsername (String name)
 Modifies the username.
 XPlayer (MIDlet midlet)

Public Attributes

boolean isGameMessageInQueue = false
 Quick check if an IN_GAME message has been received.

Static Public Attributes

static long callstarttime
 The time the current request started - used for timeout implementation.
static final int NOT_A_NUMBER = -666666
 Used to define anything that should be a number but it has not been initialised or does not have a value yet.
static final byte SCORE_TYPE_POINTS = 1
 Used to define scores that refer to points.
static final byte SCORE_TYPE_TIME = 2
 Used to define scores that are time-related.

Classes

interface  ConnectLevel
interface  Error
interface  MessageType

Constructor & Destructor Documentation

XPlayer ( MIDlet  midlet  ) 

Constructor for the XPlayer class.

It reads the values of the XPlayerURL and GGI properties from the .jad file of midlet for initialisation purposes.

Parameters:
midlet Reference to the MIDlet of the game which implements this API.


Member Function Documentation

void addByte ( byte  data  )  throws Exception

Multiplayer Specific - Add a byte to the current packet.

Parameters:
data The data to add

void addByteArray ( byte  size,
int  dataOffset,
byte[]  data 
) throws Exception

Multiplayer Specific - Add a byte array to the current packet.

Parameters:
size The size of data to add
dataOffset The offset in the input data
data The data to add

void addInt ( int  data  )  throws Exception

Multiplayer Specific - Add an int to the current packet.

Parameters:
data The data to add

void addMultipleScoreEntry ( int  score,
int  level,
int  scoreType 
)

Adds one score for one level with no supplemental data to the multiple scores buffer for multiple scores sending.

This is used to build up a request for uploading multiple scores at once to the server using sendMultipleHighscores().

Do not forget to intialise the buffer with initMultipleScores() before starting to add scores to it.

Parameters:
score The score to be uploaded.
level The level number for that score. If the game only has one leaderboard, don't send the level parameter! Call this function with level = -1.
scoreType Either SCORE_TYPE_POINTS or SCORE_TYPE_TIME, depending on the type of score.
See also:
initMultipleScores()

addMultipleScoreEntryWithSupplementalData(int, int, int, int[])

sendMultipleHighscores()

SCORE_TYPE_POINTS

SCORE_TYPE_TIME

void addMultipleScoreEntryWithSupplementalData ( int  score,
int  level,
int  scoreType,
int[]  supplemental_data 
)

Adds one score for one level with supplemental data to the multiple scores buffer for multiple scores sending.

This is used to build up a request for uploading multiple scores at once to the server using sendMultipleHighscores().

Do not forget to intialise the buffer with initMultipleScores() before starting to add scores to it.

Parameters:
score The score to be uploaded.
level The level number for that score. If the game only has one leaderboard, don't send the level parameter! Call this function with level = -1.
scoreType Either SCORE_TYPE_POINTS or SCORE_TYPE_TIME, depending on the type of score.
supplemental_data The supplemental data associated with the score to be sent.
See also:
initMultipleScores()

addMultipleScoreEntry(int, int, int)

sendMultipleHighscores()

SCORE_TYPE_POINTS

SCORE_TYPE_TIME

void addShort ( short  data  )  throws Exception

Multiplayer Specific - Add a short to the current packet.

Parameters:
data The data to add

void addString ( String  data  )  throws Exception

Multiplayer Specific - Add a string array to the current packet.

Parameters:
data The data to add

void cancel (  ) 

Cancels the ongoing request.

void cleanup (  ) 

Cleans up the memory allocated during the last server request.

Use this everytime a request completes (it finishes being pending - check with getLastError()) to free up some memory.

See also:
getLastError()

void clearData (  ) 

Multiplayer Specific - Clears the data for the current processing packet.

See also:
setData(byte[])

getData()

byte getByte (  )  throws Exception

Multiplayer Specific - Get a byte from the current packet.

Returns:
The data to get.

byte [] getByteArray ( int  dataOffset,
byte[]  datadest 
) throws Exception

Multiplayer Specific - Get a byte array from the current packet, with offset.

Parameters:
dataOffset The offset from which the data will be copied in the result buffer.
datadest The detination buffer to hold the data.
Returns:
The data to get.

byte [] getByteArray (  )  throws Exception

Multiplayer Specific - Get a byte array from the current packet.

Returns:
The data to get.

byte [] getByteDataList (  ) 

Multiplayer Specific - Get the list of specific byte data for the items hold in the internal buffers in certain multiplayer states.

The items can be either sessions (if a list session request was performed) or players (if the current player is inside a game session). If the item is a session, this data is the number of players currently in session, if the item is a player, it is the index of the player in session.

Returns:
The list of data corresponding to each player.

int getCurrentPlayerLeaderboardPosition (  ) 

Gets this user's position from the currently accessed leaderboard.

Note that for this function to return valid results:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Returns:
The user's rank within the most recently accessed leaderboard.

int getCurrentPlayerLeaderboardScore (  ) 

Gets this user's score from the currently accessed leaderboard.

Note that for this function to return a valid result:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Returns:
The user's score within the most recently accessed leaderboard.

int [] getCurrentPlayerLeaderboardScoreData (  ) 

Gets this user's supplemental data from the currently accessed leaderboard.

Note that for this function to return a valid result:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Returns:
The user's supplemental data within the most recently accessed leaderboard.

byte [] getData (  ) 

Multiplayer Specific - Gets the data for the current processing packet.

Returns:
The data to get.
See also:
setData(byte[])

String [] getDataList (  ) 

Multiplayer Specific - Get the list of specific binary data for the items hold in the internal buffers in certain multiplayer states.

The items can be either sessions, if a list session request was performed, or players, if the current player is inside a game session.

Returns:
The list of data corresponding to each player.

int getFirstSessionIndex (  ) 

Multiplayer Specific - Get the index of the first session on the multiplayer server, retrieved by the list session command.

Returns:
The index of the first session.

String getFoundPlayerName (  ) 

Multiplayer Specific - Get the name of the searched player, after a search operation has returned and was handeled with mpHandleFindPlayer().

Returns:
The name of the searched player.

String getFoundPlayerSessionName (  ) 

Multiplayer Specific - Get the name of the session the searched player is in, if any, after a search operation has returned and was handeled with mpHandleFindPlayer().

Returns:
The name of the searched player.

byte getFoundPlayerSessionNumberOfPlayers (  ) 

Multiplayer Specific - Get the number of players of the session the searched player is in, if any, after a search operation has returned and was handeled with mpHandleFindPlayer().

Returns:
The name of the searched player.

byte getFoundPlayerStatus (  ) 

Multiplayer Specific - Get the status of the searched player, after a search operation has returned and was handeled with mpHandleFindPlayer().

Returns:
The status of the searched player.

int getInt (  )  throws Exception

Multiplayer Specific - Get an int from the current packet.

Returns:
The data to get.

int getLastError (  ) 

Gets the status of the last request.

Call this after any handle function to find out the status of the request.

If ERROR_PENDING is returne, the call is still in progress.

Returns:
One of the error codes defined in the XPlayer.Error interface depending on the last request's status.
See also:
XPlayer.Error

boolean getLeaderboardData ( String[]  names,
int[]  positions,
int[]  scores,
int  scoreDatas[][] 
)

Get all the leaderboard data in a single request.

This function can be used instead of: getLeaderboardEntryPlayerName, getLeaderboardEntryPlayerPosition, getLeaderboardEntryPlayerScore and getLeaderboardEntryPlayerScoreData.

Please use only one way to get the leaderboard data, either this function or the single entry functions. That way the unused ones will be removed by the obfuscator.

The caller is responsable for allocating memory and parsing the returned array.

Note that for this function to return a valid result:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.

TODO: Add example of how to use this.

Parameters:
names The names array to fill.
positions The positions array to fill.
scores The scores array to fill.
scoreDatas The scode datas array to fill.
Returns:
true if leaderboard data was retrieved sucessfully.
See also:
getLeaderboardEntryPlayerName(int)

getLeaderboardEntryPlayerPosition(int)

getLeaderboardEntryPlayerScore(int)

getLeaderboardEntryPlayerScoreData(int)

String getLeaderboardEntryPlayerName ( int  index  ) 

Gets the name for the player at index in the server returned leaderboard player list.

Note that for this function to return valid results:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.

TODO: Add example of how the single entry functions are to be used.

Parameters:
index The players index in the currently downloaded list to get the name for.
Returns:
The name of the player at index within the leaderboard list or null if either index exceeds the leaderboard size or there is no list previously downloaded.

int getLeaderboardEntryPlayerPosition ( int  index  ) 

Gets the ranking of the player at index in the server returned leaderboard player list.

Note that for this function to return valid results:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Parameters:
index The players index in the currently downloaded list to get the rank for.
Returns:
The ranking for the player at index within the leaderboard list or -1 if either index exceeds the leaderboard size or there is no list previously downloaded.

int getLeaderboardEntryPlayerScore ( int  index  ) 

Gets the score of the player at index in the server returned leaderboard player list.

Note that for this function to return valid results:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Parameters:
index The players index in the currently downloaded list to get the score for.
Returns:
The ranking for the player at index within the leaderboard list or NOT_A_NUMBER if either index exceeds the leaderboard size or there is no list previously downloaded.

int [] getLeaderboardEntryPlayerScoreData ( int  index  ) 

Gets the supplemental data for the player at index in the server returned leaderboard player list.

Note that for this function to return valid results:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Parameters:
index The players index in the currently downloaded list to get the supplemental data for.
Returns:
The suppelmental data for the player at index within the leaderboard list or null if either index exceeds the leaderboard size or there is no list previously downloaded.

int getLeaderboardSize (  ) 

Gets the leaderboard size for the currently accessed leaderboard list.

Note that for this function to return valid results:

  • A leaderboard request must have been successfully completed using sendRankGet()/handleRankGet() or sendRankGetAroundPlayer()/handleRankGetAroundPlayer() functions.
  • The index must be is less then the leaderboardSize.
Returns:
The leaderboard size in number of players or -1 if the leaderboard is empty.

int getLength (  ) 

Multiplayer Specific - Get the data length for the current processing packet.

Returns:
The length of the package.
See also:
setData(byte[])

getData()

int getMyAvgScore (  ) 

M7 Specific - Gets the user's average score.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The average score for the user.
See also:
sendStatsGet(int, int)

int getMyBestRank (  ) 

M7 Specific - Returns the user's highest ever rank.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The best rank yet for the user.
See also:
sendStatsGet(int, int)

int getMyHighScore (  ) 

M7 Specific - Gets the user's best score.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The highest score ever for the user.
See also:
sendStatsGet(int, int)

int [] getMyHighScoreData (  ) 

M7 Specific - Gets the user's highest score's supplemental data.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The user's highest score's supplemental data array or null if none.
See also:
sendStatsGet(int, int)

String getMyLastTimePlayed (  ) 

M7 Specific - Gets the date and time the user last played.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The date and time the user last played.
See also:
sendStatsGet(int, int)

int getMyLowScore (  ) 

M7 Specific - Gets the user's lowest score.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The user's lowest score.
See also:
sendStatsGet(int, int)

int [] getMyLowScoreData (  ) 

M7 Specific - Gets the user's lowest score's supplemental data.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The user's lowest score's supplemental data array or null if none.
See also:
sendStatsGet(int, int)

int getMyNumberOfGamesPlayed (  ) 

M7 Specific - Gets the number of times the user has played the game.

This function is only valid for M7 Networks hosted games.

This function returns a valid result only if sendStatsGet() has been previously called.

Returns:
The number of times the user played.
See also:
sendStatsGet(int, int)

String [] getNameList (  ) 

Multiplayer Specific - Get the names list of the items hold in the internal buffers in certain multiplayer states.

The items can be either sessions, if a list session request was performed, or players, if the current player is inside a game session.

Returns:
The list of names.

int getNewRankAfterScoreSending (  ) 

Returns the player's new rank after a score is sent.

This function will work properly only if a score sending was performed before its call.

Returns:
The new rank.

int getNumberOfItems (  ) 

Multiplayer Specific - Get the number of sessions retrieved by the list session command.

Returns:
The number of sessions.

void getPlayerStats ( int[]  bestRankArr,
int[]  highScoreArr,
int[]  lowScoreArr,
int[]  avgScoreArr,
int[]  numberOfGamesPlayerdArr,
String[]  lastTimePlayedArr,
int[]  lowScoreDataArr,
int[]  highScoreDataArr 
)

M7 Specific - Get all the player states in a single request, previously requested from the server using the sendStatsGet and handleStatsGet functions.

This function is only valid for M7 Networks hosted games.

This function can be used to save package size and memory instead of getMyHighScore, getMyLowScore, getMyAvgScore, getMyBestRank, getMyNumberOfGamesPlayed and getMyLastTimePlayed.

Please use only one way to get the player states, either this function or the single value functions. The unused ones will be removed by the obfuscator.

The parameters are passed as an array[1], to emulate C style "pass by reference" arguments.

Important:
The caller is responsable for allocating the arrays.

Note that for this function to return valid results, a get player states request must have been previously completed successfully using the above mentioned functions.

Parameters:
bestRankArr Single value array to store bestRank.
highScoreArr Single value array to store highScore.
lowScoreArr Single value array to store lowScore.
avgScoreArr Single value array to store avgScore.
numberOfGamesPlayerdArr Single value array to store numberOfGamePlayed.
lastTimePlayedArr Single value array to store the lastTimePlayed.
lowScoreDataArr Single value array to store the lowScore supplemental data.
highScoreDataArr Single value array to store the highScore supplemental data.

String getRequestedPlayerData (  ) 

Multiplayer Specific - the data for the player whose specific data was requested using mpSendGetPlayerData() and mpHandleGetPlayerData().

USE THIS IN CONJUNCTION WITH ENABLE_PLAYER_SPECIFIC_DATA

Returns:
The specific player data.

String getRequestedPlayerNickname (  ) 

Multiplayer Specific - the nickname for the player whose specific data was requested using mpSendGetPlayerData() and mpHandleGetPlayerData().

USE THIS IN CONJUNCTION WITH ENABLE_PLAYER_SPECIFIC_DATA

Returns:
The nickname of the player.

String getSessionData (  ) 

Multiplayer Specific - Get the speficic game data for the session the player is currently in.

Returns:
The session data.

String getSessionName (  ) 

Multiplayer Specific - Get the name of the session the player is currently in.

Returns:
The name of the session.

short getShort (  )  throws Exception

Multiplayer Specific - Get a short from the current packet.

Returns:
The data to get.

String getString (  )  throws Exception

Multiplayer Specific - Get a string from the current packet.

Returns:
The data to get.

String getUsername (  ) 

Fetches the current username.

Returns:
The player's current username.
See also:
handleLogin()

void handleChangeUsername (  ) 

Handles the login or registration requests, after such a request has been initiated with sendChangeUsername(), this function's asynchronous pair.

The status of the call can be checked with getLastError().

See also:
sendChangeUsername()

getLastError()

void handleHighscore (  ) 

Handles the score uploading request, after such a request has been initiated with either sendHighscore(), sendHighscoreWithSupplementalData() or sendMultipleHighscores(), this function's asynchronous pairs.

The status of the request can be checked with getLastError().

See also:
sendHighscore(int, int, int)

sendHighscoreWithSupplementalData(int, int, int, int[])

sendMultipleHighscores()

getLastError()

void handleLogin (  ) 

Handles the login or registration requests, after such a request has been initiated with sendLogin(), this function's asynchronous pair.

The status of the call can be checked with getLastError().

The login sequence has a particular call order to ensure every possible error is treated so below we give a detailed step-by-step description. Also, please check the example given in this class' description.

	   switch (_online_substate)
	   {
		  case OnlineSubstate.SET:
		  {
			 sendLogin(null);
Request intiated - going to wait for response.
			 setOnlineSubstate(OnlineSubstate.WAIT);
			 break;
		  }

		  case OnlineSubstate.WAIT:
		  {
		  ...// provide here the option to cancel the request (for example
by pressing the LSK).

			 handleLogin();
			 _errCode = getLastError();

If the response is not pending anymore, something must have
happened. Either an error or success, we move onto PROCESS to
determine a course of action.
			 if (_errCode != XPlayer.Error.ERROR_PENDING)
			 {
				cleanup();
				setOnlineSubstate(OnlineSubstate.PROCESS);
			 }
			 break;
		  }

		  case OnlineSubstate.PROCESS:
		  {
			 switch (_errCode)
			 {
				case XPlayer.Error.ERROR_NONE:
				{
no error
success login - go to display
				   setOnlineSubstate(OnlineSubstate.DISPLAY);
				   break;
				}

				case XPlayer.Error.ERROR_NICK_TAKEN:
				{
The chose username is already taken so the user either
types another one or he chooses the one the server
automatically suggests. The suggestion is taken from the
server response and copied as the current username so to
get the suggested nickname we call:
				   suggestedName = getUsername();

Reset the nickname
				   setUsername("");

				...// Go to a state which informs the user the nick he chose is
already taken and prompt him to type another one or choose
the server-sent suggestion
				   break;
				}

				case XPlayer.Error.ERROR_REGISTER_FAILED:
				case XPlayer.Error.ERROR_NO_NICKNAME:
				case XPlayer.Error.ERROR_NO_PHONE_NUMBER:
				{
The user has not registered yet. He must be prompted to do
so and asked to type a username of his choice and his phone
number.

First we make sure username and phone number is clean and
ready for the user to edit
				   interactiv.setUsername("");
				   interactiv.setPhoneNumber("");

				...// Then we move to a state in which we ask the user to
register. From that point on, if he chooses to register,
he will have to be presented with the means to enter a
username and his phone number.
				   break;
				}

				case XPlayer.Error.ERROR_CONNECTION:
				{
				...// A connection error occured - treat the error here, for
example inform the user of its appearance and then go to a
new state. We should also provide the user the means to
retry the request.
				   break;
				}

				default:
				{
				...// Some other error occured. Also, an error message should be
displayed and an options to retry or quit provided.
				   break;
				}
			 } // End of switch (_errCode).

			 break; // Out of PROCESS.
		  }

		  case OnlineSubstate.DISPLAY:
		  {
		  ...// Display some welcome message or something to inform the user of
the successfull login.
			 break;
		  }
	   }
 

See also:
sendLogin(String)

getLastError()

void handleRankGet (  ) 

Handles the leaderboard request, after such a request has been initiated with sendRankGet, this function's asynchronous pair.

This function will check for a response or an error, update the error code accordingly (this can be checked with getLastError) and, if the request is successful, parse the message received from the server for the leaderboard data.

If the request finishes with a success:

See also:
sendRankGet(int, int, int, int)

getCurrentPlayerLeaderboardPosition()

getCurrentPlayerLeaderboardScore()

getCurrentPlayerLeaderboardScoreData()

getLeaderboardSize()

getLeaderboardEntryPlayerName(int)

getLeaderboardEntryPlayerPosition(int)

getLeaderboardEntryPlayerScore(int)

getLeaderboardEntryPlayerScoreData(int)

getLeaderboardData(String[],int[], int[], int[][])

void handleRankGetAroundPlayer (  ) 

Handles the request for getting the leaderboard entries around the user's rank, after such a request has been initiated with sendRankGetAroundPlayer(), this function's asynchronous pair.

This function will check for a response or an error, update the error code accordingly (this can be checked with getLastError()) and, if the request is successful, parse the message received from the server for the leaderboard data.

If the request finishes with a success:

See also:
sendRankGetAroundPlayer(int, int, int, int)

getCurrentPlayerLeaderboardPosition()

getCurrentPlayerLeaderboardScore()

getCurrentPlayerLeaderboardScoreData()

getLeaderboardSize()

getLeaderboardEntryPlayerName(int)

getLeaderboardEntryPlayerPosition(int)

getLeaderboardEntryPlayerScore(int)

getLeaderboardEntryPlayerScoreData(int)

getLeaderboardData(String[],int[], int[], int[][])

void handleRateGame (  ) 

M7 Specific - Handles the rate game request, after such a request has been initiated with sendRateGame, this function's asynchronous pair.

Important:
Rating games is a standard function for Sprint, Nextel, Cingular and Virgin Mobile (i.e. M7 Networks hosted games). This is NOT SUPPORTED for any other carriers.

See also:
sendRateGame(int)

void handleRecommendGame (  ) 

M7 Specific - Handles the recommend game request, after such a request has been initiated with sendRecommendGame, this function's asynchronous pair.

Important:
Recommending games is a standard function for Sprint, Nextel, Cingular and Virgin Mobile (i.e. M7 Networks hosted games). This is NOT SUPPORTED for any other carriers.

See also:
sendRecommendGame()

void handleStatsGet (  ) 

M7 Specific - Handles the request for the user's stats, after such a request has been initiated with sendStatsGet(), this function's asynchronous pair.

Important:
User statistics is a standard function for Sprint, Nextel, Cingular and Virgin Mobile (i.e. M7 Networks hosted games). This is NOT SUPPORTED for any other carriers.

See also:
sendStatsGet(int, int)

void initMultipleScores (  ) 

Initialises the multiple scores buffer for multiple score sending.

Call this before you begin assembling a list of multiple scores to be sent in one request with sendMultipleHighscores(). You must then add scores to the buffer using either addMultipleScoreEntry() or addMultipleScoreEntryWithSupplementalData() before actually sending the request.

See also:
addMultipleScoreEntry(int, int, int)

addMultipleScoreEntryWithSupplementalData(int, int, int, int[])

sendMultipleHighscores()

boolean isLoggedIn (  ) 

Provides information on wether the user has logged or registered on the server yet.

Returns true if login or registration has been initiated and has completed succesfully and false otherwise.

The login operation must be performed only once per app started. If the login was succesfull, even if the user leaves the game lobby menu, when he returns the login will not be performed again.

Returns:
Returns true if user has already logged in onto the server or false otherwise.

void mpDisconnect (  ) 

Multiplayer Specific - Finishes the connection with the multiplayer server.

void mpHandleCreateSession (  ) 

Multiplayer Specific - Handles the create game session request, after such request has been initiated with mpSendCreateSession, this function's asynchronous pair.

See also:
mpSendCreateSession(String,String)

void mpHandleDisconnect (  ) 

Multiplayer Specific - Handles the disconnect request, after such request has been initiated with mpSendDisconnect, this function's asynchronous pair.

See also:
mpHandleDisconnect()

void mpHandleEstablishConnection (  ) 

Multiplayer Specific - Handles the connection establish request, after such request has been initiated with mpSendEstablishConnection, this function's asynchronous pair.

Before any communication with the server takes place, the physical connection must be established.

See also:
mpSendEstablishConnection()

void mpHandleFindPlayer (  ) 

Multiplayer Specific - Handles the get player info request, after such request has been initiated with mpSendFindPlayer(), this function's asynchronous pair.

See also:
mpSendFindPlayer(String)

void mpHandleFinishGame (  ) 

Multiplayer Specific - Handles the finish game request, after such request has been initiated with mpSendFinishGame(), this function's asynchronous pair.

See also:
mpSendFinishGame()

void mpHandleGameData (  )  throws Exception

Multiplayer Specific - receives a game data package, used for in game messages.

See also:
mpSendGameData()

void mpHandleGetPlayerData (  ) 

Multiplayer Specific - Handles the get player info request, after such request has been initiated with mpSendGetPlayerData(), this function's asynchronous pair.

See also:
mpSendGetPlayerData(String)

void mpHandleJoinSession (  ) 

Multiplayer Specific - Handles the join game session request, after such request has been initiated with mpSendJoinSession, this function's asynchronous pair.

When the response is received, it contains the session data and the list of players currently in session.

See also:
mpSendJoinSession(String)

void mpHandleKickOutPlayer ( String  name  ) 

Multiplayer Specific - Handles the kick out player request, after such request has been initiated with mpSendKickOutPlayer(), this function's asynchronous pair.

Parameters:
name The name of the player that has been requested to be kicked out.
See also:
mpSendKickOutPlayer(String)

void mpHandleLeaveSession (  ) 

Multiplayer Specific - Handles the leave game session request, after such request has been initiated with mpSendLeaveSession, this function's asynchronous pair.

See also:
mpSendLeaveSession()

void mpHandleListSession (  ) 

Multiplayer Specific - Handles the list session request, after such request has been initiated with mpSendListSession, this function's asynchronous pair.

See also:
mpSendListSession(byte,byte)

void mpHandleLogin (  ) 

Multiplayer Specific - Handles the login request, after such request has been initiated with mpSendLogin, this function's asynchronous pair.

See also:
mpSendLogin()

void mpHandleStartGame (  ) 

Multiplayer Specific - Handles the start game request, after such request has been initiated with mpSendStartGame(), this function's asynchronous pair.

See also:
mpSendStartGame()

void mpHandleUpdates (  ) 

Multiplayer Specific - Handles the messages received from server without a previous request - push and in game messages.

This function must be called on every cycle when the player is in session or playing a game.

final boolean mpHasOpponnentFinished (  ) 

Multiplayer Specific - Test if the the opponent has finished the game.

Returns:
Returns true if finished, false otherwise.

final boolean mpIsConnected (  ) 

Multiplayer Specific - Test if the player is connected to the multiplayer server.

Returns:
Returns true if connected, false otherwise.

final boolean mpIsInGame (  ) 

Multiplayer Specific - Test if the player is in a playing a game on the multiplayer server.

Returns:
Returns true if in game, false otherwise.

final boolean mpIsInSession (  ) 

Multiplayer Specific - Test if the player is in a game session on the multiplayer server.

Returns:
Returns true if in session, false otherwise.

final boolean mpIsLoggedIn (  ) 

Multiplayer Specific - Test if the player is logged on the multiplayer server.

Returns:
Returns true if logged in, false otherwise.

final boolean mpIsMaster (  ) 

Multiplayer Specific - Test if the player is in a master in a session on the multiplayer server.

Returns:
Returns true if master, false otherwise.

void mpPrepareGameData (  )  throws Exception

Multiplayer Specific - Initialize a game data package, used for in game messages.

See also:
mpSendGameData()

void mpSendCreateSession ( String  sessionname,
String  sessiondata 
)

Multiplayer Specific - Create a new game on the multiplayer server.

The creator of the session is called master. He can kick out a player that joins the session or start the game after enough player have joined. The created game can be seen by all the players who perform a list session request. The joining of new players is signaled by a push message from the server. While being is session, the players list is available.

Parameters:
sessionname The name of the session. This is identical with the player nickname.
sessiondata Specific game data for the game session. This can include map, track, difficulty, etc.
See also:
mpHandleCreateSession()

void mpSendDisconnect (  ) 

Multiplayer Specific - Send a disconnect request to the multiplayer server.

See also:
mpHandleDisconnect()

void mpSendEstablishConnection (  ) 

Multiplayer Specific - Send an connection establish messages to the server.

See also:
mpHandleEstablishConnection()

void mpSendFindPlayer ( String  playerName  ) 

Multiplayer Specific - get info for a player - status, current game.

Get the player specific data for a specified player.

See also:
mpHandleFindPlayer()

void mpSendFinishGame (  ) 

Multiplayer Specific - Finish the game.

This message is sent by each player after he finished playing the multiplayer game.

The player will be removed from the session. The difference between finish game and leave game is that the session is not terminated when the master finished the game, but waits for all the players to finish.

See also:
mpHandleFinishGame()

void mpSendGameData (  ) 

Multiplayer Specific - Send a game data package, used for in game messages.

See also:
mpPrepareGameData()

void mpSendGetPlayerData ( String  playerName  ) 

Multiplayer Specific - Get the player specific data for a specified player.

See also:
mpHandleGetPlayerData()

void mpSendJoinSession ( String  sessionname  ) 

Multiplayer Specific - Join a game session on the multiplayer server.

After the game is joined, the player will wait for the session master to start the game.

The players list is available while being in session.

Parameters:
sessionname The name of the session to be joined.
See also:
mpHandleListSession()

void mpSendKickOutPlayer ( String  playerName  ) 

Multiplayer Specific - Kick out a player.

The session master can kick out a player before the game is started. The kicked out player will be removed from the session and receive a push message informing them about it.

If a player that is not master tries to kick out another player, this will result in an error.

Parameters:
playerName The name of the player to be kicked out.
See also:
mpHandleKickOutPlayer(String)

void mpSendLeaveSession (  ) 

Multiplayer Specific - Leave a game session.

Every player can leave a session at any time. If the player is the master of the session, the session is terminated and all the other players will receive a kick out push message.

See also:
mpHandleLeaveSession()

void mpSendListSession ( byte  numberOfSessions,
byte  firstSessionIndex 
)

Multiplayer Specific - Send a list available games request to the server.

This is how it works: a request is made to the server, containing the number of sessions requested and the index of the first session. The server replies with the list, and the data is stored in internal buffers and can be accessed using the corresponding functions.

The sessions are retrieved by page, using the parameters.

For each session are returned the index of the session, the name, one data byte with the number of players currently in session and some binary data containing game specific session data (map, track, difficulty, etc.).

After the request is completed, the session list can be accessed with getNameList, getDataList, getByteDataList, getNameList, getNumberOfItems and getFirstSessionIndex.

Parameters:
numberOfSessions The number of session requested.
firstSessionIndex The index of the first session requested.
See also:
mpHandleListSession()

void mpSendLogin ( String  player_data  ) 

Multiplayer Specific - Send a login request to the server.

After the physical connection is established, the user must authenticate before using the server features.

The login is performed based on uid, no nickname is necessary.

This version of the function can be used to set the specific player data. Use this only in conjunction with ENABLE_PLAYER_SPECIFIC_DATA.

See also:
mpHandleLogin()

void mpSendLogin (  ) 

Multiplayer Specific - Send a login request to the server.

After the physical connection is established, the user must authenticate before using the server features.

The login is performed based on uid, no nickname is necessary.

See also:
mpHandleLogin()

void mpSendQuickGame (  ) 

Multiplayer Specific - Send a quick game request to the server.

The quick game request is used to get an available game from the server. The server responds either with a session list containing only one session, in which case a join request must be performed, either with no session, in which case a create session must be performed.

The handle function for this request is mpHandleListSession

See also:
mpHandleListSession()

void mpSendStartGame (  ) 

Multiplayer Specific - Start the game.

The start signal can be sent only by the session master, after enough players have joined the session.

If another player sends the start signal or the master tries to start the game when there are not enough players yet, this will result in an error response.

After the game is started, the players can send in game messages to each other in whatever format they choose.

See also:
mpHandleStartGame()

void sendChangeUsername (  ) 

Starts a request for changing username.

This function is asynchronous.

This request may be sent to the server to change the username. The status of the request will be checked using handleChangeUsername().

void sendHighscore ( int  score,
int  level,
int  scoreType 
)

Uploads one score for one level on the server, if the level has no supplemental data.

If the score for one level has one or more supplemental data fields, they must all be send in the request, otherwise the request will fail, so you must use the sendHighscoreWithSupplementalData() function.

If multiple scores are to be sent use sendMultipleHighscores().

Parameters:
score The score to be uploaded.
level The level number for that score. If the game only has one leaderboard, don't send the level parameter! Call this function with level = -1.
scoreType Either SCORE_TYPE_POINTS or SCORE_TYPE_TIME, depending on the type of score.
See also:
sendHighscoreWithSupplementalData(int, int, int, int[])

SCORE_TYPE_POINTS

SCORE_TYPE_TIME

sendMultipleHighscores()

void sendHighscoreWithSupplementalData ( int  score,
int  level,
int  scoreType,
int[]  supplemental_data 
)

Uploads one score for one level on the server, with the supplemental data associated.

Use this instead of sendHighscore() if the score to be sent has one or more supplemental data fields. Note that the supplemental data sent with the score must contain all fields required by the server (check your game's design documentation for the complete list) otherwise the request will fail.

If multiple scores are to be sent use sendMultipleHighscores().

Parameters:
score The score to be uploaded.
level The level number for that score. If the game only has one leaderboard, don't send the level parameter! Call this function with level = -1.
scoreType Either SCORE_TYPE_POINTS or SCORE_TYPE_TIME, depending on the type of score.
supplemental_data The supplemental data associated with the score to be sent.
See also:
sendHighscore(int, int, int)

SCORE_TYPE_POINTS

SCORE_TYPE_TIME

sendMultipleHighscores()

void sendLogin ( String  playerData  ) 

Starts a request for either registration or login.

This function is asynchronous.

The normal usage is sending login at the game load, after Gameloft logo, but before game splash screen and handle the response using handleLogin().

When the application is started, a login with empty user name and phone number must be performed. If the user is registered, the server will reply with the username. If not, a registration process is started. The username must not be saved on the device, but retrieved always from the server.

As this process involves a precise call order to ensure that every possible error is handled, a detailed description on how the login sequence should look is given in the handleLogin() function's definition.

Parameters:
playerData Is by default null. If the game has specific data associated with a player (like an avatar) it should be passed here.
See also:
handleLogin()

void sendMultipleHighscores (  ) 

Uploads the scores stored in the multiple score buffer on the server.

The buffer has to be initialised with initMultipleScores() and scores have to be added to it using either addMultipleScoreEntry() or addMultipleScoreEntryWithSupplementalData()

See also:
initMultipleScores()

addMultipleScoreEntry(int, int, int)

addMultipleScoreEntryWithSupplementalData(int, int, int, int[])

void sendRankGet ( int  level,
int  number_of_players,
int  scoreType,
int  numberOfSupplementalDataFields 
)

Starts a request for one leaderboard.

This function is asynchronous.

Use handleRankGet() to handle this request.

Parameters:
level The level to get the leaderboard for.
number_of_players The maximum number of players in the leaderboard the server should return, starting with the highest ranked player.
scoreType Either SCORE_TYPE_POINTS or SCORE_TYPE_TIME, depending on the type of score. It influences the way scores are ordered. If the scores are points, a higher score is better than a lower one. If the score is a time, a lower score is better than a higher one.
numberOfSupplementalDataFields - The number of supplemental data fields associated with this leaderboard. The CALLER is RESPONSABLE for providing this value correctly otherwise the request will fail!
See also:
handleRankGet()

void sendRankGetAroundPlayer ( int  level,
int  number_of_players_around,
int  scoreType,
int  numberOfSupplementalDataFields 
)

Starts a request for getting the scores of players ranked around the user's current standing in a leaderboard.

This function is asynchronous.

Use handleRankGetAroundPlayer() to handle this request.

Parameters:
level The level to get the leaderboard for.
number_of_players_around The maximum number of players that are around the user's rank in the leaderboard the server should return.
scoreType Either SCORE_TYPE_POINTS or SCORE_TYPE_TIME, depending on the type of score. It influences the way scores are ordered. If the scores are points, a higher score is better than a lower one. If the score is a time, a lower score is better than a higher one.
numberOfSupplementalDataFields - The number of supplemental data fields associated with this leaderboard. The CALLER is RESPONSABLE for providing this value correctly otherwise the request will fail!
See also:
handleRankGetAroundPlayer()

void sendRateGame ( int  rating  ) 

M7 Specific - Sends a request for rating the game.

This function is asynchronous and valid only on M7 Networks hosted games.

The valid ratings are 1-10. The description for each as stated in M7 official documentation is:

  1. ROOT CANAL
  2. GARBAGE
  3. AWFUL
  4. DISAPOINTING
  5. AVERAGE >
  6. GOOD
  7. GREAT
  8. EXCELLENT
  9. OUTSTANDING >
  10. THE BEST

Use handleRateGame to handle the request afterwards.

Important:
Rating games is a standard function for Sprint, Nextel, Cingular and Virgin Mobile (i.e. M7 Networks hosted games). This is NOT SUPPORTED for any other carriers.

Parameters:
rating A number from 1 to 10, based on the rating the user chose for the game. See above.
See also:
handleRateGame()

void sendRecommendGame (  ) 

M7 Specific - Sends a request for recommending the game.

This function is asynchronous and valid only for M7 Networks hosted games.

Use handleRecommendGame to handle the request afterwards.

Important:
Recommending games is a standard function for Sprint, Nextel, Cingular and Virgin Mobile (i.e. M7 Networks hosted games). This is NOT SUPPORTED for any other carriers.

See also:
handleRecommendGame()

void sendStatsGet ( int  level,
int  numberOfSupplementalDataFields 
)

M7 Specific - Sends a request for the user's stats for a certain level.

This function is asynchronous and valid only on M7 Networks hosted games.

Use handleStatsGet to handle the request afterwards.

If the request completes successfully, use getMyBestRank, getMyHighScore, getMyLowScore, getMyAvgScore, getMyNumberOfGamesPlayed, getMyLastTimePlayed functions to retreive the relevant data.

Important:
User statistics is a standard function for Sprint, Nextel, Cingular and Virgin Mobile (i.e. M7 Networks hosted games). This is NOT SUPPORTED for any other carriers.

Parameters:
level The level for which the stats are retreived from the server.
numberOfSupplementalDataFields -The number of supplemental data fields associated with the specified level. The CALLER is RESPONSABLE for providing this value correctly otherwise the request will fail!
See also:
handleStatsGet()

void setData ( byte[]  data  ) 

Multiplayer Specific - Sets the data for the current processing packet.

Parameters:
data The data to set.
See also:
getData()

void setPhoneNumber ( String  phoneNr  ) 

M7 Specific - Registers the phone number associated with the player's account.

Common practice is to ask the user for a username and his phone number upon registration and set them accordingly using this and the setUsername function.

Parameters:
phoneNr The String containing the phone number to be set.
See also:
handleLogin()

sendLogin(String)

void setUsername ( String  name  ) 

Modifies the username.

Common practice is to ask the user for a username and his phone number upon registration and set them accordingly using this and the setPhoneNumber() function.

The username must be set to "" in the initial registration check. The server will reply with the correct username. The only time the setUsername() must be called with an actual username, is when the user is not yet registered with the server

Parameters:
name The string to be set as username.
See also:
handleLogin()


Member Data Documentation

long callstarttime [static]

The time the current request started - used for timeout implementation.

Use only in conjunction with ENABLE_TIMEOUT.

boolean isGameMessageInQueue = false

Quick check if an IN_GAME message has been received.

This is only used for in game messages!

final int NOT_A_NUMBER = -666666 [static]

Used to define anything that should be a number but it has not been initialised or does not have a value yet.

For example when the user inquires about his score for a level that he has never played yet or anything similar.

final byte SCORE_TYPE_POINTS = 1 [static]

Used to define scores that refer to points.

See also:
sendHighscore(int, int, int)

final byte SCORE_TYPE_TIME = 2 [static]

Used to define scores that are time-related.

See also:
sendHighscore(int, int, int)


Generated on Tue Sep 23 23:05:33 2008 for GLLib by  doxygen 1.5.2