C++ ScoreController::EasyGetScores()

From J2Play

Jump to: navigation, search

Contents

Description

Get the score record of specified score type for current user.

Syntax

const ScoreRecordSet* ScoreController::EasyGetScores(const char* scoretype);

Parameters

* @param scoretype, the type name of score

Return Value

@return const pointer to ScoreRecordSet object.

Examples

Here is the example to restore the topmost game score, which as array of (level, score, cash);

 unsigned int level;
 int score;
 __int64 cash;
 ScoreController* scorecon = CGDKInstnace::GetInstance()->GetScoreController();
 if (score)
 {
   const ScoreRecordSet* toprecord = scorecon->EasyGetScores(J2PLAY_DEFAULT_LEADER_BOARD_SCORE_TYPE);
   if (toprecord)
   {
     if (toprecord->GetRecordCount()>0 && toprecord->GetScoresCount(0)>=3)
     {
       level=static_cast<unsigned int>(toprecord->GetScoreValue(0,0));
       store=static_cast<int>(toprecord->GetScoreValue(0,1));
       cash=toprecord->GetScoreValue(0,2);
     }
     score->DestroyScoreRecordSet(toprecord);
   }
 }
Personal tools