C++ ScoreController::GetScores()

From J2Play

Jump to: navigation, search

Contents

Description

Get the score record set.

Syntax

const ScoreRecordSet* ScoreController::GetScores(
      const char* scoreType,
      bool ascending,
      const char* firstUser,
      int firstRank,
      int limit);

Parameters

* @param scoreType, the type name of score
* @param ascending, the order of result
* @param firstUser, the username whose score is retrieved
* @param firstRank, if not user assigned, the beginning rank from which the score record is retrieved
* @param limit, the count of score record trying to retrieve

Return Value

@return const pointer to ScoreRecordSet object.

Examples

Here is the example to get the top 10 "catch-and-shoot" scores of current user.

 ScoreController* scorecon = CGDKInstnace::GetInstance()->GetScoreController();
 if (score)
 {
   const ScoreRecordSet* toprecord = scorecon->GetScores("catch-and-shoot". false, CGDKInstance::GetInstance()->GetUsername(), 0, 10);
   if (toprecord)
   {
     // TODO: process the score records

     score->DestroyScoreRecordSet(toprecord);
   }
 }
Personal tools