GooglePlayGames.BasicApi.SavedGame

Summary

Enumerations

ConflictResolutionStrategy{
  UseLongestPlaytime,
  UseOriginal,
  UseUnmerged,
  UseManual,
  UseLastKnownGood,
  UseMostRecentlySaved
}
enum
An enum for the different strategies that can be used to resolve saved game conflicts (i.e.
SavedGameRequestStatus{
  TimeoutError = -1,
  InternalError = -2,
  AuthenticationError = -3,
  BadInputError = -4
}
enum
An enum for the different statuses that can be returned by the saved game client.
SelectUIStatus{
  SavedGameSelected = 1,
  UserClosedUI = 2,
  InternalError = -1,
  TimeoutError = -2,
  AuthenticationError = -3,
  BadInputError = -4
}
enum
An enum for the different UI statuses that can be returned by the saved game client.

Functions

ConflictCallback(IConflictResolver resolver, ISavedGameMetadata original, byte[] originalData, ISavedGameMetadata unmerged, byte[] unmergedData)
delegate void
A delegate that is invoked when we encounter a conflict during execution of ISavedGameClient.OpenWithAutomaticConflictResolution.

Structs

GooglePlayGames.BasicApi.SavedGame.SavedGameMetadataUpdate

A struct representing the mutation of saved game metadata.

Interfaces

GooglePlayGames.BasicApi.SavedGame.IConflictResolver

An interface that allows developers to resolve metadata conflicts that may be encountered while opening saved games.

GooglePlayGames.BasicApi.SavedGame.ISavedGameClient

The main entry point for interacting with saved games.

GooglePlayGames.BasicApi.SavedGame.ISavedGameMetadata

Interface representing the metadata for a saved game.

Enumerations

ConflictResolutionStrategy

 ConflictResolutionStrategy

An enum for the different strategies that can be used to resolve saved game conflicts (i.e.

conflicts produced by two or more separate writes to the same saved game at once).

Properties
UseLastKnownGood

The use last known good snapshot to resolve conflicts automatically.

UseLongestPlaytime

Choose which saved game should be used on the basis of which one has the longest recorded play time.

In other words, in the case of a conflicting write, the saved game with the longest play time will be considered cannonical. If play time has not been provided by the developer, or in the case of two saved games with equal play times, UseOriginal will be used instead.

UseManual

Manual resolution, no automatic resolution is attempted.

UseMostRecentlySaved

The use most recently saved snapshot to resolve conflicts automatically.

UseOriginal

Choose the version of the saved game that existed before any conflicting write occurred.

Consider the following case:

  • An initial version of a save game ("X") is written from a device ("Dev_A")
  • The save game X is downloaded by another device ("Dev_B").
  • Dev_A writes a new version of the save game to the cloud ("Y")
  • Dev_B does not see the new save game Y, and attempts to write a new save game ("Z").
  • Since Dev_B is performing a write using out of date information, a conflict is generated.

In this situation, we can resolve the conflict by declaring either keeping Y as the canonical version of the saved game (i.e. choose "original" aka UseOriginal), or by overwriting it with conflicting value, Z (i.e. choose "unmerged" aka UseUnmerged).

UseUnmerged

See the documentation for UseOriginal

SavedGameRequestStatus

 SavedGameRequestStatus

An enum for the different statuses that can be returned by the saved game client.

Properties
AuthenticationError

A error related to authentication.

This is probably due to the user being signed out before the request could be issued.

BadInputError

The request failed because it was given bad input (e.g.

a filename with 200 characters).

InternalError

An unexpected internal error.

Check the log for error messages.

TimeoutError

The request failed due to a timeout.

SelectUIStatus

 SelectUIStatus

An enum for the different UI statuses that can be returned by the saved game client.

Properties
AuthenticationError

An error related to authentication.

This error could be due to the user being signed out before the request could be issued.

BadInputError

The request failed due to invalid input.

For example, the filename exceeded the 200 character limit..

InternalError

An unexpected internal error.

Check the log for error messages.

SavedGameSelected

The user selected a saved game.

TimeoutError

There was a timeout while displaying the UI.

UserClosedUI

The user closed the UI without selecting a saved game.

Functions

ConflictCallback

delegate void ConflictCallback(
  IConflictResolver resolver,
  ISavedGameMetadata original,
  byte[] originalData,
  ISavedGameMetadata unmerged,
  byte[] unmergedData
)

A delegate that is invoked when we encounter a conflict during execution of ISavedGameClient.OpenWithAutomaticConflictResolution.

The caller must resolve the conflict using the passed IConflictResolver. All passed metadata is open. If ISavedGameClient.OpenWithAutomaticConflictResolution was invoked with prefetchDataOnConflict set to true, the originalData and unmergedData will be equal to the binary data of the "original" and "unmerged" saved game respectively (and null otherwise). Since conflict files may be generated by other clients, it is possible that neither of the passed saved games were originally written by the current device. Consequently, any conflict resolution strategy should not rely on local data that is not part of the binary data of the passed saved games - this data will not be present if conflict resolution occurs on a different device. In addition, since a given saved game may have multiple conflicts, this callback must be designed to handle multiple invocations.