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)); } }
public static AGSScore fromHashtable( Hashtable scoreHashTable ) { var score = new AGSScore(); score.player = AGSPlayer.fromHashtable(scoreHashTable["player"] as Hashtable); score.rank = int.Parse( scoreHashTable["rank"].ToString() ); score.scoreString = scoreHashTable["scoreString"].ToString(); score.scoreValue = long.Parse( scoreHashTable["score"].ToString() ); return score; }
public static AGSScore fromHashtable(Hashtable scoreHashTable) { var score = new AGSScore(); score.player = AGSPlayer.fromHashtable(scoreHashTable["player"] as Hashtable); score.rank = int.Parse(scoreHashTable["rank"].ToString()); score.scoreString = scoreHashTable["scoreString"].ToString(); score.scoreValue = long.Parse(scoreHashTable["score"].ToString()); return(score); }
public static AGSScore fromHashtable( Hashtable ht ) { var score = new AGSScore(); score.playerAlias = ht["playerAlias"].ToString(); score.rank = int.Parse( ht["rank"].ToString() ); score.scoreString = ht["scoreString"].ToString(); score.scoreValue = long.Parse( ht["scoreValue"].ToString() ); return score; }
public static List <AGSScore> fromArrayList(ArrayList list) { var scores = new List <AGSScore>(); foreach (Hashtable ht in list) { scores.Add(AGSScore.fromHashtable(ht)); } return(scores); }
public static AGSScore fromHashtable(Hashtable ht) { var score = new AGSScore(); score.playerAlias = ht["playerAlias"].ToString(); score.rank = int.Parse(ht["rank"].ToString()); score.scoreString = ht["scoreString"].ToString(); score.scoreValue = long.Parse(ht["scoreValue"].ToString()); return(score); }
/// <summary> /// Initializes a new instance of the <see cref="AGSSocialLeaderboardScore"/> class. /// </summary> /// <param name='score'> /// Score. /// </param> /// <param name='leaderboard'> /// Leaderboard. /// </param> public AGSSocialLeaderboardScore(AGSScore score, AGSLeaderboard leaderboard) { if(null == score) { AGSClient.LogGameCircleError("AGSSocialLeaderboardScore constructor \"score\" argument should not be null"); return; } if(null == leaderboard) { AGSClient.LogGameCircleError("AGSSocialLeaderboardScore constructor \"leaderboard\" argument should not be null"); return; } this.score = score; leaderboardID = leaderboard.id; value = score.scoreValue; }
/// <summary> /// Initializes a new instance of the <see cref="AGSSocialLeaderboardScore"/> class. /// </summary> /// <param name='score'> /// Score. /// </param> /// <param name='leaderboard'> /// Leaderboard. /// </param> public AGSSocialLeaderboardScore(AGSScore score, AGSLeaderboard leaderboard) { if (null == score) { AGSClient.LogGameCircleError("AGSSocialLeaderboardScore constructor \"score\" argument should not be null"); return; } if (null == leaderboard) { AGSClient.LogGameCircleError("AGSSocialLeaderboardScore constructor \"leaderboard\" argument should not be null"); return; } this.score = score; leaderboardID = leaderboard.id; value = score.scoreValue; }
public static AGSLeaderboard fromHashtable(Hashtable ht) { var board = new AGSLeaderboard(); board.name = ht["name"].ToString(); board.id = ht["id"].ToString(); board.displayText = ht["displayText"].ToString(); board.scoreFormat = ht["scoreFormat"].ToString(); // handle scores if we have them if (ht.ContainsKey("scores") && ht["scores"] is ArrayList) { var scoresList = ht["scores"] as ArrayList; board.scores = AGSScore.fromArrayList(scoresList); } return(board); }
/// <summary> /// Initializes a new instance of the <see cref="AGSSocialLeaderboardScore"/> class. /// </summary> public AGSSocialLeaderboardScore() { this.score = null; leaderboardID = null; }