Game
Unity API
11 years ago

[Deprecated] Getting started with the Unity API Helper v1.2


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

Loading...

Next up

Did you know that today is #InternationalJazzDay? 🎷😎

No? 😯 Well, we couldn't pass up this date!

And what better to celebrate this day than #Pecaminosa #OST? 🎷

Let us know what you think about it and have a great weekend!

Shoobies leave a sticky trail of mucus in their wake, which can impede movement for any creature that steps in it.

Terraria

Showing off player 2 😎

What do you think?

Why walk when you can jump?

We're glad to announce that Baby Dino Adventures 🦖 is now available in Early Access here on GameJolt! Link: https://gamejolt.com/games/babydinoadventures/508121 Walk, run, and jump as a baby t-rex in this cute platformer Free demo available #IndieGame | #GameDev | #PixelArt

Today I tackled drawing different variations of facial expressions for one of the main characters in Eden. What do you think of it? :) Eden: https://gamejolt.com/games/Eden/592698

Cash Banooca

not the greatest house, but it's a house! :D

A few screenshots of the places you'll cross in the Demo of Blu. You can play it today on #gamejolt !