Class GameServices
Provides cross-platform interface to easily integrate popular social gaming functionalities such as achievements, leaderboards on your mobile games.
Inheritance
Inherited Members
Namespace: VoxelBusters.EssentialKit
Assembly: cs.temp.dll.dll
Syntax
public static class GameServices
Properties
AchievementDefinitions
Declaration
public static AchievementDefinition[] AchievementDefinitions { get; }
Property Value
Type | Description |
---|---|
AchievementDefinition[] |
AchievementDescriptions
Returns the cached achievement description array.
Declaration
public static IAchievementDescription[] AchievementDescriptions { get; }
Property Value
Type | Description |
---|---|
IAchievementDescription[] |
Remarks
\note This property is invalid until a call to LoadAchievementDescriptions(EventCallback<GameServicesLoadAchievementDescriptionsResult>) is completed.
Achievements
Returns the cached achievements array.
Declaration
public static IAchievement[] Achievements { get; }
Property Value
Type | Description |
---|---|
IAchievement[] |
Remarks
\note This property is invalid until a call to LoadAchievements(EventCallback<GameServicesLoadAchievementsResult>) is completed.
IsAuthenticated
A boolean value indicating whether this local player is authenticated.
Declaration
public static bool IsAuthenticated { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
|
LeaderboardDefinitions
Declaration
public static LeaderboardDefinition[] LeaderboardDefinitions { get; }
Property Value
Type | Description |
---|---|
LeaderboardDefinition[] |
Leaderboards
Returns the cached leaderboards array.
Declaration
public static ILeaderboard[] Leaderboards { get; }
Property Value
Type | Description |
---|---|
ILeaderboard[] |
Remarks
\note This property is invalid until a call to LoadLeaderboards(EventCallback<GameServicesLoadLeaderboardsResult>) is completed.
LocalPlayer
Returns the local player.
Declaration
public static ILocalPlayer LocalPlayer { get; }
Property Value
Type | Description |
---|---|
ILocalPlayer | The local player. |
UnitySettings
Declaration
public static GameServicesUnitySettings UnitySettings { get; }
Property Value
Type | Description |
---|---|
GameServicesUnitySettings |
Methods
Authenticate()
Initiates authentication process for the local player on the device.
Declaration
public static void Authenticate()
CreateAchievement(String)
Creates a new instance of achievement object.
Declaration
public static IAchievement CreateAchievement(string achievementId)
Parameters
Type | Name | Description |
---|---|---|
System.String | achievementId | A string used to uniquely identify the achievement. |
Returns
Type | Description |
---|---|
IAchievement |
CreateLeaderboard(String)
Creates a new instance of leaderboard object.
Declaration
public static ILeaderboard CreateLeaderboard(string leaderboardId)
Parameters
Type | Name | Description |
---|---|---|
System.String | leaderboardId | A string used to uniquely identify the leaderboard. |
Returns
Type | Description |
---|---|
ILeaderboard |
CreateScore(String)
Creates the score for specified leaderboard.
Declaration
public static IScore CreateScore(string leaderboardId)
Parameters
Type | Name | Description |
---|---|---|
System.String | leaderboardId | A string used to uniquely identify the leaderboard. |
Returns
Type | Description |
---|---|
IScore | The score object. |
CreateScore(ILeaderboard)
Creates the score for specified leaderboard.
Declaration
public static IScore CreateScore(ILeaderboard leaderboard)
Parameters
Type | Name | Description |
---|---|---|
ILeaderboard | leaderboard | The leaderboard object. |
Returns
Type | Description |
---|---|
IScore | The score object. |
Initialize()
Initializes game services.
Declaration
public static void Initialize()
IsAvailable()
Declaration
public static bool IsAvailable()
Returns
Type | Description |
---|---|
System.Boolean |
LoadAchievementDescriptions(EventCallback<GameServicesLoadAchievementDescriptionsResult>)
Loads the achievement descriptions from game server.
Declaration
public static void LoadAchievementDescriptions(EventCallback<GameServicesLoadAchievementDescriptionsResult> callback)
Parameters
Type | Name | Description |
---|---|---|
EventCallback<GameServicesLoadAchievementDescriptionsResult> | callback | Callback method that will be invoked after operation is completed. |
LoadAchievements(EventCallback<GameServicesLoadAchievementsResult>)
Loads previously submitted achievement progress for the current local player.
Declaration
public static void LoadAchievements(EventCallback<GameServicesLoadAchievementsResult> callback)
Parameters
Type | Name | Description |
---|---|---|
EventCallback<GameServicesLoadAchievementsResult> | callback | Callback method that will be invoked after operation is completed. |
LoadLeaderboards(EventCallback<GameServicesLoadLeaderboardsResult>)
Loads the leaderboards.
Declaration
public static void LoadLeaderboards(EventCallback<GameServicesLoadLeaderboardsResult> callback)
Parameters
Type | Name | Description |
---|---|---|
EventCallback<GameServicesLoadLeaderboardsResult> | callback | Callback method that will be invoked after operation is completed. |
LoadPlayers(String[], EventCallback<GameServicesLoadPlayersResult>)
Loads the player details from game server.
Declaration
public static void LoadPlayers(string[] playerIds, EventCallback<GameServicesLoadPlayersResult> callback)
Parameters
Type | Name | Description |
---|---|---|
System.String[] | playerIds | An array of player id's whose details has to be retrieved from game server. |
EventCallback<GameServicesLoadPlayersResult> | callback | Callback that will be called after operation is completed. |
ReportAchievementProgress(String, Double, CompletionCallback)
Reports the local user's achievement progress to game server, using platform specific id.
Declaration
public static void ReportAchievementProgress(string achievementId, double percentageCompleted, CompletionCallback callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | achievementId | A string used to uniquely identify the achievement. |
System.Double | percentageCompleted | The value indicates how far the player has progressed. |
CompletionCallback | callback | Callback that will be called after operation is completed. |
ReportAchievementProgress(IAchievement, Double, CompletionCallback)
Reports the local user's achievement progress to game server.
Declaration
public static void ReportAchievementProgress(IAchievement achievement, double percentageCompleted, CompletionCallback callback)
Parameters
Type | Name | Description |
---|---|---|
IAchievement | achievement | The achievement object. |
System.Double | percentageCompleted | The value indicates how far the player has progressed. |
CompletionCallback | callback | Callback that will be called after operation is completed. |
ReportAchievementProgress(IAchievementDescription, Double, CompletionCallback)
Reports the local user's achievement progress to game server.
Declaration
public static void ReportAchievementProgress(IAchievementDescription achievementDescription, double percentageCompleted, CompletionCallback callback)
Parameters
Type | Name | Description |
---|---|---|
IAchievementDescription | achievementDescription | The achievement description object. |
System.Double | percentageCompleted | The value indicates how far the player has progressed. |
CompletionCallback | callback | Callback that will be called after operation is completed. |
ReportScore(String, Int64, CompletionCallback)
Reports the score to game server.
Declaration
public static void ReportScore(string leaderboardId, long value, CompletionCallback callback)
Parameters
Type | Name | Description |
---|---|---|
System.String | leaderboardId | A string used to uniquely identify the leaderboard. |
System.Int64 | value | |
CompletionCallback | callback | Callback that will be called after operation is completed. |
ReportScore(ILeaderboard, Int64, CompletionCallback)
Reports the score to game server.
Declaration
public static void ReportScore(ILeaderboard leaderboard, long value, CompletionCallback callback)
Parameters
Type | Name | Description |
---|---|---|
ILeaderboard | leaderboard | The leaderboard object. |
System.Int64 | value | |
CompletionCallback | callback | Callback that will be called after operation is completed. |
ShowAchievements(EventCallback<GameServicesViewResult>)
Opens the standard view to display achievement progress screen for the local player.
Declaration
public static void ShowAchievements(EventCallback<GameServicesViewResult> callback = null)
Parameters
Type | Name | Description |
---|---|---|
EventCallback<GameServicesViewResult> | callback | Callback that will be called after operation is completed. |
ShowLeaderboard(String, LeaderboardTimeScope, EventCallback<GameServicesViewResult>)
Opens the standard view to display leaderboard scores corresponding to given id.
Declaration
public static void ShowLeaderboard(string leaderboardId, LeaderboardTimeScope timescope = LeaderboardTimeScope.AllTime, EventCallback<GameServicesViewResult> callback = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | leaderboardId | A string used to identify the leaderboard. |
LeaderboardTimeScope | timescope | A time filter used to restrict which scores are displayed to the player. |
EventCallback<GameServicesViewResult> | callback | Callback that will be called after operation is completed. |
Remarks
\note Incase, if you want to list out all the leaderboards that are used in your game, then pass null
for leaderboard identifier.
ShowLeaderboard(ILeaderboard, LeaderboardTimeScope, EventCallback<GameServicesViewResult>)
Opens the standard view to display leaderboard scores corresponding to given leaderboard.
Declaration
public static void ShowLeaderboard(ILeaderboard leaderboard, LeaderboardTimeScope timescope = LeaderboardTimeScope.AllTime, EventCallback<GameServicesViewResult> callback = null)
Parameters
Type | Name | Description |
---|---|---|
ILeaderboard | leaderboard | The leaderboard object. |
LeaderboardTimeScope | timescope | A time filter used to restrict which scores are displayed to the player. |
EventCallback<GameServicesViewResult> | callback | Callback that will be called after operation is completed. |
Remarks
\note Incase, if you want to list out all the leaderboards that are used in your game, then pass null
for leaderboard identifier.
ShowLeaderboards(LeaderboardTimeScope, EventCallback<GameServicesViewResult>)
Opens the standard view to display all the leaderboards.
Declaration
public static void ShowLeaderboards(LeaderboardTimeScope timescope = LeaderboardTimeScope.AllTime, EventCallback<GameServicesViewResult> callback = null)
Parameters
Type | Name | Description |
---|---|---|
LeaderboardTimeScope | timescope | A time filter used to restrict which scores are displayed to the player. |
EventCallback<GameServicesViewResult> | callback | Callback that will be called after operation is completed. |
Events
OnAuthStatusChange
Event called on local player auth change.
Declaration
public static event EventCallback<GameServicesAuthStatusChangeResult> OnAuthStatusChange
Event Type
Type | Description |
---|---|
EventCallback<GameServicesAuthStatusChangeResult> |