示例#1
0
        /// <summary>
        /// Handles an <c>onGetScoresFinished</c> event
        /// </summary>
        /// <param name="message">
        /// Will contain a numeric representation of <c>Provider</c>,
        /// and payload</param>
        public void onGetScoresFinished(String message)
        {
            SoomlaUtils.LogDebug(TAG, "SOOMLA/UNITY onGetScoresFinished");

            JSONObject eventJson = new JSONObject(message);

            Provider    provider = Provider.fromInt((int)eventJson["provider"].n);
            Leaderboard owner    = new Leaderboard(eventJson["leaderboard"]);

            bool hasMore = eventJson["hasMore"].b;

            JSONObject payloadJSON = new JSONObject(eventJson ["payload"].str);

            JSONObject   scoresArray = eventJson ["scores"];
            List <Score> scores      = new List <Score>();

            foreach (JSONObject scoreJson in scoresArray.list)
            {
                scores.Add(new Score(scoreJson));
            }

            SocialPageData <Score> data = new SocialPageData <Score>();

            data.PageData   = scores;
            data.PageNumber = 0;
            data.HasMore    = hasMore;

            ProfileEvents.OnGetScoresFinished(new GetScoresFinishedEvent(provider, owner, data, ProfilePayload.GetUserPayload(payloadJSON)));
        }