/// <summary>
    /// Loads the scores.
    /// </summary>
    /// <param name='leaderboardID'>
    /// Leaderboard I.
    /// </param>
    /// <param name='callback'>
    /// Callback.
    /// </param>
    public void LoadScores(string leaderboardID, System.Action <IScore[]> callback)
    {
        // Forward the AGSClient callbacks to the passed in callback.
        if (null != callback)
        {
            AGSLeaderboardsClient.RequestLeaderboardsSucceededEvent += (leaderboards) => {
                // If the leaderboard could not be found, call the callback with a null list.
                IScore [] scores = null;

                // Look through the retrieved leaderboards for the passed in leaderboard ID
                foreach (AGSLeaderboard leaderboard in leaderboards)
                {
                    if (leaderboard.id == leaderboardID)
                    {
                        AGSSocialLeaderboard socialLeaderboard = new AGSSocialLeaderboard(leaderboard);
                        scores = socialLeaderboard.scores;
                        break;
                    }
                }
                callback(scores);
            };
            // If retrieving leaderboards failed, call the callback with a null list.
            AGSLeaderboardsClient.RequestLeaderboardsFailedEvent += (error) => { callback(null); };
        }
        // Request the leaderboard list so the requested leaderboard ID can be searched for.
        AGSLeaderboardsClient.RequestLeaderboards();
    }
 /// <summary>
 /// Requests the list of leaderboards from the GameCircle plugin.
 /// </summary>
 void RequestLeaderboards()
 {
     // Start the clock, to track the progress of this async operation.
     leaderboardsRequestTime = System.DateTime.Now;
     // Subscribe to the events to receive the leaderboard list.
     SubscribeToLeaderboardRequestEvents();
     // Request the leaderboard list from the GameCircle plugin.
     AGSLeaderboardsClient.RequestLeaderboards();
     // Set the status message to show this process has begun.
     requestLeaderboardsStatus = requestingLeaderboardsLabel;
 }
Exemplo n.º 3
0
 /// <summary>
 /// Loads the scores.
 /// </summary>
 /// <param name='leaderboardID'>
 /// Leaderboard I.
 /// </param>
 /// <param name='callback'>
 /// Callback.
 /// </param>
 public void LoadScores(string leaderboardID, Action <IScore[]> callback)
 {
     loadScoresCallbacks.Add(requestID, callback);
     AGSLeaderboardsClient.RequestLeaderboards(requestID++);
 }
Exemplo n.º 4
0
 public void RequestLeaderboards()
 {
             #if AMAZON_CIRCLE_ENABLED
     AGSLeaderboardsClient.RequestLeaderboards();
             #endif
 }