gpg::AchievementManager

#include <achievement_manager.h>

Gets and sets various achievement-related data.

Summary

Public types

FetchAllCallback typedef
std::function< void(const FetchAllResponse &)>
Defines a callback type that receives a FetchAllResponse.
FetchCallback typedef
std::function< void(const FetchResponse &)>
Defines a callback type that receives a FetchResponse.
ShowAllUICallback typedef
std::function< void(const UIStatus &)>
Defines a callback type that receives a UIStatus.

Public functions

Fetch(const std::string & achievement_id, FetchCallback callback)
void
Asynchronously loads data for a specific achievement for the currently signed-in player.
Fetch(DataSource data_source, const std::string & achievement_id, FetchCallback callback)
void
Asynchronously loads data for a specific achievement for the currently signed-in player.
FetchAll(FetchAllCallback callback)
void
Asynchronously loads all achievement data for the currently signed-in player.
FetchAll(DataSource data_source, FetchAllCallback callback)
void
Asynchronously loads all achievement data for the currently signed-in player.
FetchAllBlocking()
Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.
FetchAllBlocking(DataSource data_source)
Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.
FetchAllBlocking(Timeout timeout)
Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.
FetchAllBlocking(DataSource data_source, Timeout timeout)
Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.
FetchBlocking(const std::string & achievement_id)
Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.
FetchBlocking(DataSource data_source, const std::string & achievement_id)
Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.
FetchBlocking(Timeout timeout, const std::string & achievement_id)
Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.
FetchBlocking(DataSource data_source, Timeout timeout, const std::string & achievement_id)
Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.
Increment(const std::string & achievement_id)
void
Increments an achievement by the given number of steps.
Increment(const std::string & achievement_id, uint32_t steps)
void
Increments an achievement by the given number of steps.
Reveal(const std::string & achievement_id)
void
Reveal a hidden achievement to the currently signed-in player.
SetStepsAtLeast(const std::string & achievement_id, uint32_t steps)
void
Set an achievement to have at least the given number of steps completed.
ShowAllUI(ShowAllUICallback callback)
void
Presents to the user a UI that displays information about all achievements.
ShowAllUI()
void
Deprecated. Prefer ShowAllUI(ShowAllUICallback callback). Presents a UI to the user that displays information about all achievements. The UI is shown asynchronously on all platforms.
ShowAllUIBlocking()
Presents to the user a UI that displays information about all achievements.
ShowAllUIBlocking(Timeout timeout)
Presents to the user a UI that displays information about all achievements.
Unlock(const std::string & achievement_id)
void
Unlocks an achievement for the currently signed in player.

Structs

gpg::AchievementManager::FetchAllResponse

Holds all data for all achievements, along with a response status.

gpg::AchievementManager::FetchResponse

Contains data and response status for a single achievement.

Public types

FetchAllCallback

std::function< void(const FetchAllResponse &)> FetchAllCallback

Defines a callback type that receives a FetchAllResponse.

This callback type is provided to the FetchAll(*) functions below.

FetchCallback

std::function< void(const FetchResponse &)> FetchCallback

Defines a callback type that receives a FetchResponse.

This callback type is provided to the Fetch(*) functions below.

ShowAllUICallback

std::function< void(const UIStatus &)> ShowAllUICallback

Defines a callback type that receives a UIStatus.

This callback type is provided to the ShowAllUI* function below.

Public functions

Fetch

void Fetch(
  const std::string & achievement_id,
  FetchCallback callback
)

Asynchronously loads data for a specific achievement for the currently signed-in player.

Calls the provided FetchCallback upon operation completion. Not specifying data_source makes this function call equivalent to calling Fetch(DataSource data_source, const std::string& id, FetchCallback), with data_source specified as CACHE_OR_NETWORK.

Fetch

void Fetch(
  DataSource data_source,
  const std::string & achievement_id,
  FetchCallback callback
)

Asynchronously loads data for a specific achievement for the currently signed-in player.

Calls the provided FetchCallback on operation completion. Specify data_source as CACHE_OR_NETWORK or NETWORK_ONLY.

FetchAll

void FetchAll(
  FetchAllCallback callback
)

Asynchronously loads all achievement data for the currently signed-in player.

Calls the provided FetchAllCallback upon operation completion. Not specifying data_source makes this function call equivalent to calling FetchAll(DataSource data_source, FetchAllCallback), with data_source specified as CACHE_OR_NETWORK.

FetchAll

void FetchAll(
  DataSource data_source,
  FetchAllCallback callback
)

Asynchronously loads all achievement data for the currently signed-in player.

Calls the provided FetchAllCallback upon operation completion. Specify data_source as CACHE_OR_NETWORK or NETWORK_ONLY.

FetchAllBlocking

FetchAllResponse FetchAllBlocking()

Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.

Specifying neither data_source nor timeout makes this function call equivalent to calling FetchAllResponse FetchAllBlocking(DataSource data_source, Timeout timeout), with data_source specified as CACHE_OR_NETWORK, and timeout specified as 10 years.

FetchAllBlocking

FetchAllResponse FetchAllBlocking(
  DataSource data_source
)

Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.

Specify data_source as CACHE_OR_NETWORK or NETWORK_ONLY. Not specifying timeout makes this function call equivalent to calling FetchAllBlocking FetchAllResponse(DataSource data_source, Timeout timeout), with your specified data_source value, and timeout specified as 10 years.

FetchAllBlocking

FetchAllResponse FetchAllBlocking(
  Timeout timeout
)

Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.

Specify timeout as an arbitrary number of milliseconds. Not specifying data_source makes this function call equivalent to calling FetchAllResponse FetchAllBlocking(DataSource data_source, Timeout timeout), with data_source specified as CACHE_OR_NETWORK, and timeout containing your specified value.

FetchAllBlocking

FetchAllResponse FetchAllBlocking(
  DataSource data_source,
  Timeout timeout
)

Synchronously loads all achievement data for the currently signed-in player, directly returning the FetchAllResponse.

Specify data_source as CACHE_OR_NETWORK or NETWORK_ONLY. Specify timeout as an arbitrary number of milliseconds.

FetchBlocking

FetchResponse FetchBlocking(
  const std::string & achievement_id
)

Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.

Leaving data_source and timeout unspecified makes this function call equivalent to calling FetchResponse FetchBlocking(DataSource data_source, Timeout timeout, const std::string& id), with data_source specified as CACHE_OR_NETWORK, and timeout specified as 10 years.

FetchBlocking

FetchResponse FetchBlocking(
  DataSource data_source,
  const std::string & achievement_id
)

Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.

Specify data_source as CACHE_OR_NETWORK or NETWORK_ONLY. Leaving timeout unspecified makes this function call equivalent to calling FetchResponse FetchBlocking(DataSource data_source, Timeout timeout, const std::string& id), with your specified data_source value, and timeout specified as 10 years.

FetchBlocking

FetchResponse FetchBlocking(
  Timeout timeout,
  const std::string & achievement_id
)

Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.

Specify timeout as an arbitrary number of milliseconds. Leaving data_source unspecified makes this function call equivalent to calling FetchResponse FetchBlocking(DataSource data_source, Timeout timeout, const std::string& id), with data_source specified as CACHE_OR_NETWORK, and timeout containing your specified value.

FetchBlocking

FetchResponse FetchBlocking(
  DataSource data_source,
  Timeout timeout,
  const std::string & achievement_id
)

Synchronously loads data for a specific achievement, identified by string id, for the currently signed-in player; directly returns the FetchResponse.

Specify data_source as CACHE_OR_NETWORK or NETWORK_ONLY. Specify timeout as an arbitrary number of milliseconds.

Increment

void Increment(
  const std::string & achievement_id
)

Increments an achievement by the given number of steps.

Leaving the increment undefined causes its value to default to 1. The achievement must be an incremental achievement. Once an achievement reaches the maximum number of steps, it is unlocked automatically. Any further increments are ignored.

Increment

void Increment(
  const std::string & achievement_id,
  uint32_t steps
)

Increments an achievement by the given number of steps.

The achievement must be an incremental achievement. Once an achievement reaches at least the maximum number of steps, it will be unlocked automatically. Any further increments will be ignored.

Reveal

void Reveal(
  const std::string & achievement_id
)

Reveal a hidden achievement to the currently signed-in player.

If the achievement has already been unlocked, this will have no effect.

SetStepsAtLeast

void SetStepsAtLeast(
  const std::string & achievement_id,
  uint32_t steps
)

Set an achievement to have at least the given number of steps completed.

Calling this method while the achievement already has more steps than the provided value is a no-op. Once the achievement reaches the maximum number of steps, the achievement is automatically unlocked, and any further mutation operations are ignored.

ShowAllUI

void ShowAllUI(
  ShowAllUICallback callback
)

Presents to the user a UI that displays information about all achievements.

It asynchronously calls ShowAllUICallback.

ShowAllUI

void ShowAllUI()

Deprecated. Prefer ShowAllUI(ShowAllUICallback callback). Presents a UI to the user that displays information about all achievements. The UI is shown asynchronously on all platforms.

ShowAllUIBlocking

UIStatus ShowAllUIBlocking()

Presents to the user a UI that displays information about all achievements.

It synchronously returns a UIStatus. Not specifying timeout makes this function call equivalent to calling ShowAllUIBlocking(Timeout timeout) with timeout specified as 10 years.

ShowAllUIBlocking

UIStatus ShowAllUIBlocking(
  Timeout timeout
)

Presents to the user a UI that displays information about all achievements.

It synchronously returns a UIStatus. Specify timeout as an arbitrary number of milliseconds.

Unlock

void Unlock(
  const std::string & achievement_id
)

Unlocks an achievement for the currently signed in player.

If the achievement is hidden, the SDK reveals it, as well.