Ejemplo n.º 1
0
void
GoogleTalk::CheckLoginStatus()
{
	if(fAuth && fRostered &&  fAgent && !fFullLogged) 
		LoggedIn();
		
}
Ejemplo n.º 2
0
void
Jabber::CheckLoginStatus()
{
	if(fAuth && fRostered &&  fAgent && !fFullLogged) 
		LoggedIn();
		
}
Ejemplo n.º 3
0
// This is still somewhat game-specific.  (Because it assumes that your
// leaderboards are tied to events.)  TODO: clean this up further later.
void GPGManager::ShowLeaderboards(const GPGIds *ids, size_t id_len) {
#ifdef NO_GPG
  return;
#endif
  if (!LoggedIn()) return;
  SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "GPG: launching leaderboard UI");
  // First, get all current event counts from GPG in one callback,
  // which allows us to conveniently update and show the leaderboards without
  // having to deal with multiple callbacks.
  game_services_->Events().FetchAll([id_len, ids, this](
      const gpg::EventManager::FetchAllResponse &far) {
    for (auto it = far.data.begin(); it != far.data.end(); ++it) {
      // Look up leaderboard id from corresponding event id.
      const char *leaderboard_id = nullptr;
      for (size_t i = 0; i < id_len; i++) {
        if (ids[i].event == it->first) {
          leaderboard_id = ids[i].leaderboard;
        }
      }
      assert(leaderboard_id);
      if (leaderboard_id) {
        game_services_->Leaderboards().SubmitScore(leaderboard_id,
                                                   it->second.Count());
        SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
                    "GPG: submitted score %llu for id %s", it->second.Count(),
                    leaderboard_id);
      }
    }
    game_services_->Leaderboards().ShowAllUI([](const gpg::UIStatus &status) {
      SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
                  "GPG: Leaderboards UI FAILED, UIStatus is: %d", status);
    });
  });
}
Ejemplo n.º 4
0
void GPGManager::IncrementEvent(const char *event_id, uint64_t score) {
#ifdef NO_GPG
  return;
#endif
  if (!LoggedIn()) return;
  game_services_->Events().Increment(event_id, score);
}
Ejemplo n.º 5
0
void GPGManager::ShowAchievements() {
#ifdef NO_GPG
  return;
#endif
  if (!LoggedIn()) return;
  SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION, "GPG: launching achievement UI");
  game_services_->Achievements().ShowAllUI([](const gpg::UIStatus &status) {
    SDL_LogInfo(SDL_LOG_CATEGORY_APPLICATION,
                "GPG: Achievement UI FAILED, UIStatus is: %d", status);
  });
}
Ejemplo n.º 6
0
// Updates local player achievements with values from the server:
void GPGManager::FetchAchievements() {
  if (!LoggedIn() || achievement_data_state_ == kPending) return;
  achievement_data_state_ = kPending;

  game_services_->Achievements().FetchAll(
      [this](const gpg::AchievementManager::FetchAllResponse &far) mutable {

        pthread_mutex_lock(&achievements_mutex_);

        if (IsSuccess(far.status)) {
          achievement_data_state_ = kComplete;
          achievement_data_initialized_ = true;
        } else {
          achievement_data_state_ = kFailed;
        }

        achievement_data_ = far.data;
        pthread_mutex_unlock(&achievements_mutex_);
      });
}
Ejemplo n.º 7
0
// Reveals a given achievement.
void GPGManager::RevealAchievement(std::string achievement_id) {
  if (LoggedIn()) {
    game_services_->Achievements().Reveal(achievement_id);
  }
}
Ejemplo n.º 8
0
// Increments an incremental achievement by an amount.
void GPGManager::IncrementAchievement(std::string achievement_id,
                                      uint32_t steps) {
  if (LoggedIn()) {
    game_services_->Achievements().Increment(achievement_id, steps);
  }
}
Ejemplo n.º 9
0
// Unlocks a given achievement.
void GPGManager::UnlockAchievement(std::string achievement_id) {
  if (LoggedIn()) {
    game_services_->Achievements().Unlock(achievement_id);
  }
}