Warning! This version of the API is deprecated. You should use version 2 instead!
Make sure to read the API tutorial first.
1 - Core Helper
Initialization
It looks like you’ve been used to the API already but no, you don’t need to initialize the helper. You can use it straight away. It will initialize itself when you first call it.
User Helpers
Retrieve user information from the Game Jolt website. It takes one parameter: a callback that accept 2 strings as parameters.
// Helper call.
GJAPIHelper.Users.GetFromWeb (OnGetFromWeb);
// Callback
void OnGetFromWeb (string name, string token)
{
Debug.Log (name + "@" + token);
}
Show/Dismiss the login window.
GJAPIHelper.Users.ShowLogin ();
GJAPIHelper.Users.DismissLogin ();
Show the user some love. You need to have a verified user though.
GJAPIHelper.Users.ShowGreetingNotification ();
Download a user avatar. If it fails, a default avatar will be supplied. It takes two parameters: the user and a callback that accept a Texture2D as parameter.
// Helper call
GJAPIHelper.Users.DownloadUserAvatar (user, OnCompleteCallback);
// Callback
void OnCompleteCallback (Texture2D avatar) {}
Score Helpers
Show/Dismiss the leaderboards.
GJAPIHelper.Scores.ShowLeaderboards ();
GJAPIHelper.Scores.DismissLeaderboards ();
Trophies Helpers
Set secret trophies. Pass the secret trophies IDs and a boolean (true if you want the trophies to show with ??? as description or false if you don’t want them to show unless they are already unlocked.
uint[] secret_trophies = {1432,2345};
GJAPIHelper.Trophies.SetSecretTrophies (secret_trophies, true);
Show/Dismiss the trophies list.
GJAPIHelper.Trophies.ShowTrophies ();
GJAPIHelper.Trophies.DismissTrophies ();
Show a trophy unlock notification. It takes one parameter: the trophy ID.
GJAPIHelper.Trophies.ShowTrophyUnlockNotification (1337);
Download a trophy icon. If it fails, a default icon will be supplied. It takes two parameters: the trophy and a callback that accept a Texture2D as parameter.
// Helper call
GJAPIHelper.Trophies.DownloadTrophyIcon (trophy, OnCompleteCallback);
// Callback
void OnCompleteCallback (Texture2D icon) {}
2 - Modify/Extend it!
GUI Skin
Change the GUI Skin.
GJAPIHelper.Skin = MySkin;
Use the Helper GUI Skin for your own GUI.
void OnGUI ()
{
GUI.skin = GJAPIHepler.Skin;
}
Custom Notifications
Create it.
// Small notification with text only.
// This is used by Users.ShowGreetingNotification.
GJHNotification textOnlyNotification =
new GJHNotification ("Title");
// Bigger notification with an icon.
// This is used by Trophies.ShowTrophyUnlockNotification.
GJHNotification withIconNotification =
new GJHNotification ("Title", "Description", icon);
Customize it a bit.
myNotification.Anchor = GJHNotificationAnchor.TopLeft;
myNotification.DisplayTime = 3f;
Add it to the queue. It will wait until there is no other notification showing if there is any.
GJHNotificationsManager.QueueNotification (notification1);
GJHNotificationsManager.QueueNotification (notification2);
98 comments