Exemplo n.º 1
0
        void ReadLeaderboardSuccess(string json, object cb)
        {
            Debug.Log("Leaderboard json: " + json);

            Dictionary <string, object> jObj = JsonReader.Deserialize <Dictionary <string, object> >(json);
            Dictionary <string, object> data = (Dictionary <string, object>)jObj["data"];
            List <object> entries            = (List <object>)data["social_leaderboard"];

            if (entries != null)
            {
                Dictionary <string, object> jEntry = null;

                foreach (object entry in entries)
                {
                    jEntry = (Dictionary <string, object>)entry;
                    LBEntry lbe = new LBEntry();
                    lbe.playerId = (string)jEntry["playerId"];
                    lbe.name     = (string)jEntry["name"];
                    lbe.rank     = System.Convert.ToInt64(jEntry["rank"]);
                    lbe.score    = System.Convert.ToInt64(jEntry["score"]);

                    m_lb.Add(lbe);
                }
            }
        }
Exemplo n.º 2
0
        void ReadLeaderboardSuccess(string json, object cb)
        {
            Debug.Log("Leaderboard json: " + json);

            JsonData jObj         = JsonMapper.ToObject(json);
            JsonData jLeaderboard = jObj["data"]["social_leaderboard"];
            IList    entries      = jLeaderboard as IList;

            if (entries != null)
            {
                foreach (JsonData jEntry in entries)
                {
                    LBEntry lbe = new LBEntry();
                    lbe.playerId = (string)jEntry["playerId"];
                    lbe.name     = (string)jEntry["name"];

                    if (jEntry["rank"].IsInt)
                    {
                        lbe.rank = (int)jEntry["rank"];
                    }
                    else
                    {
                        lbe.rank = (long)jEntry["rank"];
                    }

                    if (jEntry["score"].IsInt)
                    {
                        lbe.score = (int)jEntry["score"];
                    }
                    else
                    {
                        lbe.score = (long)jEntry["score"];
                    }
                    m_lb.Add(lbe);
                }
            }
        }
		void ReadLeaderboardSuccess(string json, object cb)
		{
			Debug.Log ("Leaderboard json: " + json);

			JsonData jObj = JsonMapper.ToObject(json);
			JsonData jLeaderboard = jObj["data"]["social_leaderboard"];
			IList entries = jLeaderboard as IList;
			if (entries != null)
			{
				foreach (JsonData jEntry in entries)
				{
					LBEntry lbe = new LBEntry();
					lbe.playerId = (string) jEntry["playerId"];
					lbe.name = (string) jEntry["name"];

					if (jEntry["rank"].IsInt)
					{
						lbe.rank = (int) jEntry["rank"];
					}
					else
					{
						lbe.rank = (long) jEntry["rank"];
					}

					if (jEntry["score"].IsInt)
					{
						lbe.score = (int) jEntry["score"];
					}
					else
					{
						lbe.score = (long) jEntry["score"];
					}
					m_lb.Add (lbe);
				}
			}
		}