Exemplo n.º 1
0
    /// <summary>
    /// Reads the get multiple scores response.
    /// </summary>
    /// <param name='response'>
    /// The response.
    /// </param>
    void ReadGetResponse(string response)
    {
        GJScore[] scores;

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

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

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

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

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

        if (GetMultipleCallback != null)
        {
            GetMultipleCallback(scores);
        }
    }
Exemplo n.º 2
0
    /// <summary>
    /// Reads the get multiple scores response.
    /// </summary>
    /// <param name='response'>
    /// The response.
    /// </param>
    void ReadGetResponse(string response)
    {
        GJScore[] scores;

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

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

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

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

        if (GetMultipleCallback != null)
        {
            GetMultipleCallback (scores);
        }
    }
Exemplo n.º 3
0
 private void GetScoreCallback(GJScore[] scores)
 {
     _scores = scores;
     blockUserInput = false;
 }
Exemplo n.º 4
0
    /// <summary>
    /// GetScores callback.
    /// </summary>
    /// <param name='s'>
    /// The scores. <seealso cref="GJScore"/>.
    /// </param>
    void OnGetScores(GJScore[] s)
    {
        GJAPI.Scores.GetMultipleCallback -= OnGetScores;

        if (s == null)
        {
            SetWindowMessage ("Error loading scores.");
            ChangeState (BaseWindowStates.Error.ToString ());
            return;
        }

        scores = s;

        ChangeState (ScoresWindowStates.ScoresList.ToString ());
    }