Ejemplo n.º 1
0
 public static AGSRequestScoresResponse FromJSON(string json)
 {
     try {
         AGSRequestScoresResponse response = new AGSRequestScoresResponse();
         Hashtable hashtable = json.hashtableFromJson();
         response.error         = hashtable.ContainsKey("error") ? hashtable ["error"].ToString() : "";
         response.userData      = hashtable.ContainsKey("userData") ? int.Parse(hashtable ["userData"].ToString()) : 0;
         response.leaderboardId = hashtable.ContainsKey("leaderboardId") ? hashtable ["leaderboardId"].ToString() : "";
         if (hashtable.ContainsKey("leaderboard"))
         {
             response.leaderboard = AGSLeaderboard.fromHashtable(hashtable ["leaderboard"] as Hashtable);
         }
         else
         {
             response.leaderboard = AGSLeaderboard.GetBlankLeaderboard();
         }
         response.scores = new List <AGSScore> ();
         if (hashtable.Contains("scores"))
         {
             foreach (Hashtable scoreHashtable in hashtable["scores"] as ArrayList)
             {
                 response.scores.Add(AGSScore.fromHashtable(scoreHashtable));
             }
         }
         response.scope = (LeaderboardScope)Enum.Parse(typeof(LeaderboardScope), hashtable["scope"].ToString());
         return(response);
     } catch (Exception e) {
         AGSClient.LogGameCircleError(e.ToString());
         return(GetBlankResponseWithError(JSON_PARSE_ERROR));
     }
 }
Ejemplo n.º 2
0
    public static List <AGSScore> fromArrayList(ArrayList list)
    {
        var scores = new List <AGSScore>();

        foreach (Hashtable ht in list)
        {
            scores.Add(AGSScore.fromHashtable(ht));
        }

        return(scores);
    }