void ScoreLoopThread::LoadLeaderboardAroundScore(AppData_t *app, SC_Score_h score, SC_ScoresSearchList_t searchList, unsigned int count) {
	/* Create a ScoresController */
	SC_Error_t rc = SC_Client_CreateScoresController(app->client, &app->scoresController, LoadLeaderboardCompletionCallback, app);
	if (rc != SC_OK) {
		HandleError(app, rc);
		return;
	}

	/* Configure the Controller */
	SC_ScoresController_SetMode(app->scoresController, SC_Score_GetMode(score));
	rc = SC_ScoresController_SetSearchList(app->scoresController, searchList);
	if (rc != SC_OK) {
		SC_ScoresController_Release(app->scoresController); /* Cleanup Controller */
		HandleError(app, rc);
		return;
	}

	/* Load the Leaderboard for the given score and count */
	rc = SC_ScoresController_LoadScoresAroundScore(app->scoresController, score, count);
	if (rc != SC_OK) {
		SC_ScoresController_Release(app->scoresController); /* Cleanup Controller */
		HandleError(app, rc);
		return;
	}
	qDebug() << "Loading Leaderboard...";
}
Ejemplo n.º 2
0
void CScores::OnRequestSuccessRanking()
{	
	//Get score and rank
	m_curuserscore = 0;
	m_curuserrank = (int)SC_RankingController_GetRanking(m_rankingController);
	SC_Score_h score = SC_RankingController_GetScore(m_rankingController);
	if (score)
	{
		m_curuserscore = (int)SC_Score_GetResult(score);
		m_curuserminorresult = (int)SC_Score_GetMinorResult(score);
	}
	if (g_localhighscore > m_curuserscore) //Submit local highscore if need be
	{
		
		DoSubmitScore();
		StartWait("Submiting current user score");
		
	}
	else // Else loading scores list
	{
		//See OnRequestSuccess()
		SC_ScoresController_SetMode(m_scoresController, 1);
		SC_ScoresController_LoadRange(m_scoresController, 0, SC_PAGE_SCORES_COUNT);		
		StartWait("Loading global scores");
	}
}
FREObject setMode(FREContext ctx, void* functionData, uint32_t argc, FREObject argv[])
{

	int aMode = 0;
	FREGetObjectAsInt32(argv[0],&aMode);
	SC_ScoresController_SetMode(scores_controller, aMode);
	return NULL;
}