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

Been working lately on lots of 'behind-the-scenes' boring stuff that no one really cares about, so here’s a guy playing the sax for some reason.

#screenshotsaturday

Finished a project I've been working on over the last few days!

Modeled and textured in Blender.

#3dart #lowpoly #npbr #fantasy #hut

Shadow The Hedgehog X pixel art

So here's the first of the zodiac signs i will make for the next weeks.

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

Showing off player 2 😎

What do you think?

Auto-chess meets Clash Royale in an intense strategic battle. Outsmart your opponent, hide your play and crush their armies! Empire Builder just got another major update, check it out! https://gamejolt.com/games/EmpireBuilder/558901

Hi all, Quick update with a bunch of fixes and changes.

Updated save system, optimisation and screen tear fixes, a new shoutout room and more sounds.

Don't forget to follow the kickstarter going live on the 20th! https://www.kickstarter.com/projects/9fingergames/zapling-bygone

Enjoy!

THANK YOU FOR 400 FOLLOWERS!!!

Here is a drawing a I made FOR ALL OF YOU

LOVE YOU GUYS❤

Daldos Gameplay