Game
Unity API
12 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

We are under attack!

🍒Did you like the game? A demo is available for free on Steam.

✌️ Thanks for playing IndieGameiacs!

⚙️ Free Demo: http://bit.ly/UniDuni

📺 Full Video: https://youtu.be/5qEbVXg7GaQ

#steam #uniduni #clops #screenshotsaturday

Back in my art school days I used to ride the 710 COPSA line from Parque Del Plata to Montevideo almost everyday. This is the Marcopolo Viaggio G4 Mercedes Benz model from the late 80s, one of the older bus models that was running on the line.

One of the most critical update for Sunblaze demo. Now you are able to pet a cat! Finally!

Horror WIP A track that will be featured in a future horror game soundtrack! Stay tuned!

Likes appreciated ✌️

#gamedev #composer #horrorgame #indiegame #IndieGameDev #soundtrack

Terraria

Spaaaace~

These are background sprites I've created for a game I'm working on at school ^w^ Click on the post to see how the sprites connect. You won't regret it! (personally, I think it's pretty heheh)

Drawn in Piskel using my mouse. Whaddya think?

Levels' maps.

brung back my old oc plus a new one

...they don`t have names yet tho