コード例 #1
0
    private void OnRequestScoresCompleted(AGSRequestScoresResponse response)
    {
        // Put scores in leaderboard.
        AGSSocialLeaderboard leaderboard = leaderboardForRequest.ContainsKey(response.userData) ? leaderboardForRequest[response.userData] : null;

        if (null != leaderboard && !response.IsError())
        {
            leaderboard.scores = new IScore[response.scores.Count];
            for (int i = 0; i < response.scores.Count; i++)
            {
                leaderboard.scores[i] = new AGSSocialLeaderboardScore(response.scores[i], response.leaderboard);
            }
        }
        // Handle any callbacks
        Action <bool> callback = simpleCallbacks.ContainsKey(response.userData) ? simpleCallbacks[response.userData] : null;

        if (null != callback)
        {
            callback(!response.IsError());
        }
        Action <IScore[]> scoreCallback = loadScoresCallbacks.ContainsKey(response.userData) ? loadScoresCallbacks[response.userData] : null;

        if (null != scoreCallback)
        {
            IScore[] scores = new IScore[response.scores.Count];
            for (int i = 0; i < response.scores.Count; i++)
            {
                scores[i] = new AGSSocialLeaderboardScore(response.scores[i], response.leaderboard);
            }
            scoreCallback(scores);
        }
        // cleanup
        leaderboardForRequest.Remove(response.userData);
        simpleCallbacks.Remove(response.userData);
    }
コード例 #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSocialLeaderboard"/> class.
 /// </summary>
 /// <param name='leaderboard'>
 /// Leaderboard.
 /// </param>
 public AGSSocialLeaderboard(AGSLeaderboard leaderboard)
 {
     if(null == leaderboard) {
         AGSClient.LogGameCircleError("AGSSocialLeaderboard constructor \"leaderboard\" argument should not be null");
         this.leaderboard = AGSLeaderboard.GetBlankLeaderboard();
     } else {
         this.leaderboard = leaderboard;
     }
     id = leaderboard.id;
     scores = new AGSSocialLeaderboardScore[0];
     localPlayerScore = -1;
     localPlayerRank = -1;
     _timeScope = TimeScope.AllTime;
 }
コード例 #3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AGSSocialLeaderboard"/> class.
 /// </summary>
 /// <param name='leaderboard'>
 /// Leaderboard.
 /// </param>
 public AGSSocialLeaderboard(AGSLeaderboard leaderboard)
 {
     if (null == leaderboard)
     {
         AGSClient.LogGameCircleError("AGSSocialLeaderboard constructor \"leaderboard\" argument should not be null");
         this.leaderboard = AGSLeaderboard.GetBlankLeaderboard();
     }
     else
     {
         this.leaderboard = leaderboard;
     }
     id               = leaderboard.id;
     scores           = new AGSSocialLeaderboardScore[0];
     localPlayerScore = -1;
     localPlayerRank  = -1;
     _timeScope       = TimeScope.AllTime;
 }
コード例 #4
0
        private void OnRequestScoresCompleted(AGSRequestScoresResponse response)
        {
            var scoreCallback = loadScoresCallbacks.ContainsKey(response.userData)
                ? loadScoresCallbacks[response.userData]
                : null;

            if (scoreCallback != null)
            {
                var scores = new IScore[response.scores.Count];
                for (var i = 0; i < response.scores.Count; i++)
                {
                    scores[i] = new AGSSocialLeaderboardScore(response.scores[i], response.leaderboard);
                }

                scoreCallback(scores);
            }

            if (loadScoresCallbacks.ContainsKey(response.userData))
            {
                loadScoresCallbacks.Remove(response.userData);
            }
        }
コード例 #5
0
ファイル: GameCircleSocial.cs プロジェクト: EJBQ/Bae-Zeus-X
 private void OnRequestScoresCompleted(AGSRequestScoresResponse response)
 {
     // Put scores in leaderboard.
     AGSSocialLeaderboard leaderboard = leaderboardForRequest.ContainsKey (response.userData) ? leaderboardForRequest[response.userData] : null;
     if (null != leaderboard && !response.IsError()) {
         leaderboard.scores = new IScore[response.scores.Count];
         for (int i = 0; i < response.scores.Count; i++) {
             leaderboard.scores[i] = new AGSSocialLeaderboardScore(response.scores[i], response.leaderboard);
         }
     }
     // Handle any callbacks
     Action<bool> callback = simpleCallbacks.ContainsKey(response.userData) ? simpleCallbacks[response.userData] : null;
     if (null != callback) {
         callback(!response.IsError());
     }
     Action<IScore[]> scoreCallback = loadScoresCallbacks.ContainsKey (response.userData) ? loadScoresCallbacks[response.userData] : null;
     if (null != scoreCallback) {
         IScore[] scores = new IScore[response.scores.Count];
         for (int i = 0; i < response.scores.Count; i++) {
             scores[i] = new AGSSocialLeaderboardScore(response.scores[i], response.leaderboard);
         }
         scoreCallback(scores);
     }
     // cleanup
     leaderboardForRequest.Remove (response.userData);
     simpleCallbacks.Remove (response.userData);
 }