예제 #1
0
    /// <summary>
    /// Reads the get multiple users response.
    /// </summary>
    /// <param name='response'>
    /// The response.
    /// </param>
    void ReadGetMultipleResponse(string response)
    {
        GJUser[] users;

        bool success = GJAPI.Instance.IsResponseSuccessful(response);

        if (!success)
        {
            GJAPI.Instance.GJDebug("Could not get the users.\n" + response, LogType.Error);
            users = null;
        }
        else
        {
            Dictionary <string, string>[] dictionaries = GJAPI.Instance.ResponseToDictionaries(response);
            GJAPI.Instance.CleanDictionaries(ref dictionaries);

            StringBuilder debug = new StringBuilder();
            debug.Append("Users successfully fetched.\n");

            int count = dictionaries.Length;
            users = new GJUser [count];
            for (int i = 0; i < count; i++)
            {
                users [i] = new GJUser(dictionaries [i]);
                debug.Append(users [i].ToString());
            }

            GJAPI.Instance.GJDebug(debug.ToString());
        }

        if (GetMultipleCallback != null)
        {
            GetMultipleCallback(users);
        }
    }
예제 #2
0
    /// <summary>
    /// Reads the get one user response.
    /// </summary>
    /// <param name='response'>
    /// The response.
    /// </param>
    void ReadGetOneResponse(string response)
    {
        GJUser user;

        bool success = GJAPI.Instance.IsResponseSuccessful(response);

        if (!success)
        {
            GJAPI.Instance.GJDebug("Could not get the user.\n" + response, LogType.Error);
            user = null;
        }
        else
        {
            Dictionary <string, string> dictionary = GJAPI.Instance.ResponseToDictionary(response);
            GJAPI.Instance.CleanDictionary(ref dictionary);

            user = new GJUser(dictionary);
            GJAPI.Instance.GJDebug("User successfully fetched.\n" + user.ToString());
        }

        if (GetOneCallback != null)
        {
            GetOneCallback(user);
        }
    }
예제 #3
0
 public GJFriends(GJCore GJCore, GJUser GJuser)
 {
     username    = GJuser.username;
     user_token  = GJuser.user_token;
     game_id     = GJCore.game_id;
     private_key = GJCore.private_key;
     apiurl      = GJCore.apiurl;
 }
예제 #4
0
 public GJSession(GJCore GJCore, GJUser GJUser)
 {
     //make table id and game_id publics
     game_id     = GJUser.game_id;
     username    = GJUser.username;
     user_token  = GJUser.user_token;
     private_key = GJCore.private_key;
     apiurl      = GJCore.apiurl;
 }
예제 #5
0
        static void Main()
        {
            GJCore     c = new GJCore("86282091", "9021he90h9210");
            GJUser     u = new GJUser(c, "MMDDKK", "0mad6");
            GJTrophies t = new GJTrophies(c, u);

            Console.WriteLine(c.game_id);
            Console.WriteLine(t);
            Console.ReadKey();
        }
예제 #6
0
        static void Main(string[] args)
        {
            Console.Write("User Name: ");
            var user = Console.ReadLine();

            Console.Write("Token: ");
            var token = Console.ReadLine();

            var gju = new GJUser(testgame, testprivate, user, token);

            gju.AwardTrophy("107249");
        }
예제 #7
0
    /// <summary>
    /// Downloads the user avatar.
    /// </summary>
    /// <param name='user'>
    /// The user.
    /// </param>
    /// <param name='OnComplete'>
    /// The callback.
    /// </param>
    public void DownloadUserAvatar(GJUser user, Action <Texture2D> OnComplete)
    {
        GJAPIHelper.DownloadImage(
            user.AvatarURL,
            avatar =>
        {
            if (avatar == null)
            {
                avatar = (Texture2D)Resources.Load("Images/UserAvatar", typeof(Texture2D)) ?? new Texture2D(60, 60);
            }

            if (OnComplete != null)
            {
                OnComplete(avatar);
            }
        });
    }
예제 #8
0
    /// <summary>
    /// Downloads the user avatar.
    /// </summary>
    /// <param name='user'>
    /// The user.
    /// </param>
    /// <param name='OnComplete'>
    /// The callback.
    /// </param>
    public void DownloadUserAvatar(GJUser user, Action<Texture2D> OnComplete)
    {
        GJAPIHelper.DownloadImage (
            user.AvatarURL,
            avatar =>
            {
                if (avatar == null)
                {
                    avatar = (Texture2D) Resources.Load ("Images/UserAvatar", typeof (Texture2D)) ?? new Texture2D (60,60);
                }

                if (OnComplete != null)
                {
                    OnComplete (avatar);
                }
            });
    }
예제 #9
0
    /// <summary>
    /// Reads the get one user response.
    /// </summary>
    /// <param name='response'>
    /// The response.
    /// </param>
    void ReadGetOneResponse(string response)
    {
        GJUser user;

        bool success = GJAPI.Instance.IsResponseSuccessful (response);
        if (!success)
        {
            GJAPI.Instance.GJDebug ("Could not get the user.\n" + response, LogType.Error);
            user = null;
        }
        else
        {
            Dictionary<string,string> dictionary = GJAPI.Instance.ResponseToDictionary (response);
            GJAPI.Instance.CleanDictionary (ref dictionary);

            user = new GJUser (dictionary);
            GJAPI.Instance.GJDebug ("User successfully fetched.\n" + user.ToString());
        }

        if (GetOneCallback != null)
        {
            GetOneCallback (user);
        }
    }
예제 #10
0
    /// <summary>
    /// Reads the get multiple users response.
    /// </summary>
    /// <param name='response'>
    /// The response.
    /// </param>
    void ReadGetMultipleResponse(string response)
    {
        GJUser[] users;

        bool success = GJAPI.Instance.IsResponseSuccessful (response);
        if (!success)
        {
            GJAPI.Instance.GJDebug ("Could not get the users.\n" + response, LogType.Error);
            users = null;
        }
        else
        {
            Dictionary<string,string>[] dictionaries = GJAPI.Instance.ResponseToDictionaries (response);
            GJAPI.Instance.CleanDictionaries (ref dictionaries);

            StringBuilder debug = new StringBuilder();
            debug.Append ("Users successfully fetched.\n");

            int count = dictionaries.Length;
            users = new GJUser [count];
            for (int i = 0; i < count; i++)
            {
                users [i] = new GJUser (dictionaries [i]);
                debug.Append (users [i].ToString ());
            }

            GJAPI.Instance.GJDebug (debug.ToString ());
        }

        if (GetMultipleCallback != null)
        {
            GetMultipleCallback (users);
        }
    }
예제 #11
0
파일: GJAPI.cs 프로젝트: nyrrrr/LD28
 /// <summary>
 /// Releases unmanaged resources and performs other cleanup operations before the application quit.
 /// </summary>
 void OnApplicationQuit()
 {
     StopAllCoroutines ();
     user = null;
     users = null;
     sessions = null;
     trophies = null;
     scores = null;
     data = null;
     instance = null;
 }