private void OnAmazonScoresLoaded(AMN_ScoresLoadedResult result)
    {
        UM_Leaderboard leaderboard = UltimateMobileSettings.Instance.GetLeaderboardByAmazonId(result.LeaderboardId);

        if (leaderboard != null)
        {
            leaderboard.Setup(SA_AmazonGameCircleManager.Instance.GetLeaderboard(result.LeaderboardId));

            UM_LeaderboardResult res = new UM_LeaderboardResult(leaderboard, result);
            ActionScoresListLoaded(res);
        }
    }
Exemple #2
0
    private void OnTopScoresLoaded(AGSRequestScoresResponse response)
    {
        AMN_ScoresLoadedResult result = null;

        if (response.IsError())
        {
            Debug.Log("[OnTopScoresLoaded] error " + response.error);
            result = new AMN_ScoresLoadedResult(response.leaderboardId, response.error);
        }
        else
        {
            Debug.Log("[OnTopScoresLoaded] " + response.scores.Count + " scores loaded");
            GC_Leaderboard lb = GetLeaderboard(response.leaderboardId);
            if (lb != null)
            {
                foreach (AGSScore score in response.scores)
                {
                    Debug.Log(string.Format("[OnTopScoresLoaded] AGSScore {0}|{1}|{2}|{3}|{4}",
                                            score.player.playerId,
                                            response.leaderboardId,
                                            score.rank,
                                            score.scoreValue,
                                            response.scope.GetGCTimeSpan().ToString()));

                    GC_Player player = new GC_Player(score.player);
                    AddPlayer(player);

                    GC_Score s = new GC_Score(score.player.playerId, response.leaderboardId, score.rank, score.scoreValue, response.scope.GetGCTimeSpan());
                    lb.UpdateScore(s);
                }
            }
            result = new AMN_ScoresLoadedResult(lb);
        }

        OnScoresLoaded(result);
    }