C++ ScoreController::EasySetScores()

From J2Play

Jump to: navigation, search

Contents

Description

Stores an array of score values for the specified score type.

Syntax

bool ScoreController::EasySetScores(const char* scoretype, long long* values, unsigned int count);

Parameters

* @param scoretype, the type name of score
* @param values, a 64 bits integer array of score values
* @param count, the count of score values in the values array

Return Value

@return true if score has been submitted to score server successfully, otherwise false

Examples

Here is the example to store following game score information:

unsigned int level = 1;
int score = 532;
__int64 cash = 2300;

Serialize game scores into an array and send them

 long long scores[3];
 scores[0]=level;
 scores[1]=score;
 scores[2]=cash;
 
 ScoreController scorecon = CGDKInstance::GetInstance()->GetScoreController();
 if (scorecon && scorecon->EasySetScores(J2PLAY_DEFAULT_LEADER_BOARD_SCORE_TYPE, scores, 3))
 {
  // submit score successfully
 }
 else
 {
  // error
 }
Personal tools