SebastianLawe

Untitled

Feb 3rd, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.14 KB | None | 0 0
  1. using UnityEngine;
  2. using System.Collections;
  3. public class GameJoltAPIManager : MonoBehaviour
  4. {
  5.     // On GameJolt, go to 'Dashboard', click the game you're adding this to, and go to 'Achievements'
  6.     // There will be a window called 'Game Info' that has this info
  7.     public int gameID;
  8.     public string privateKey;
  9.     public string userName;
  10.     public string userToken;
  11.     void Awake()
  12.     {
  13.         // Make sure the game object stays even if the player goes to a different scene
  14.         DontDestroyOnLoad(gameObject);
  15.         // Initialize the API
  16.         GJAPI.Init(gameID, privateKey);
  17.         // Show the Login window
  18.         GJAPIHelper.Users.ShowLogin();
  19.         // Make sure the person is actually a person
  20.         GJAPI.Users.Verify(userName, userToken);
  21.     }
  22.     void OnEnable()
  23.     {
  24.         GJAPI.Users.VerifyCallback += OnVerifyUser;
  25.     }
  26.     void OnDisable()
  27.     {
  28.         GJAPI.Users.VerifyCallback -= OnVerifyUser;
  29.     }
  30.     void OnVerifyUser(bool success)
  31.     {
  32.         if (success)
  33.         {
  34.             Debug.Log("Works");
  35.         }
  36.         else
  37.         {
  38.             Debug.Log("Failed");
  39.         }
  40.     }
  41. }
Advertisement
Add Comment
Please, Sign In to add comment