void OnlineService::connect() { //printf("onlineservice connect\n"); fflush(stdout); assert(has_user_controller == false); assert(state == DISCONNECTED); SC_Error_t createUserControllerResult = SC_Client_CreateUserController(scoreloop_client, &scoreloop_user_controller, RequestUserControllerCompleted, 0); if (createUserControllerResult != SC_OK) { //printf("SC_Client_CreateUserController failed with code %i\n", createUserControllerResult); fflush(stdout); return; // handle error } has_user_controller = true; SC_Error_t loadUserResult = SC_UserController_LoadUser(scoreloop_user_controller); if (loadUserResult == SC_OK) { state = LOAD_USER; } else { //printf("SC_UserController_LoadUser failed with code %i\n", loadUserResult); fflush(stdout); SC_UserController_Release(scoreloop_user_controller); state = DISCONNECTED; return; // handle error } printf("online connect done\n"); fflush(stdout); }
void ScoreLoopThread::RequestUser(AppData_t *app) { /* Create a UserController */ SC_Error_t rc = SC_Client_CreateUserController(app->client, &app->userController, RequestUserCompletionCallback, app); if (rc != SC_OK) { HandleError(app, rc); return; } /* Make the asynchronous request */ rc = SC_UserController_LoadUser(app->userController); if (rc != SC_OK) { SC_UserController_Release(app->userController); HandleError(app, rc); return; } qDebug() << "Requesting User..."; }
CScores::CScores(): CBaseScene() { m_listview = 0; // Creating Scoreloop Controllers SC_Error_t retCode = SC_Client_CreateScoresController(g_client, &m_scoresController, ScoresControllerCallback, this); if (retCode != SC_OK) { m_scoresController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_ScoresController"); } SC_Client_CreateScoreController(g_client, &m_scoreController, ScoreControllerCallbackSubmit, this); if (retCode != SC_OK) { m_scoreController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_ScoreController"); } SC_Client_CreateRankingController(g_client, &m_rankingController, RankingControllerCallback, this); if (retCode != SC_OK) { m_rankingController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_RankingController"); } SC_Client_CreateUserController(g_client, &m_userController, UserControllerCallback, this); if (retCode != SC_OK) { m_userController = NULL; s3eDebugAssertShow(S3E_MESSAGE_CONTINUE_STOP, "Failed to create SC_UserController"); } }