コード例 #1
0
 public void ReportScore(long score, string board, Action <bool> callback)
 {
     if (!IsAuthenticated())
     {
         Logger.e("ReportScore can only be called after authentication.");
         callback?.Invoke(false);
     }
     else
     {
         Logger.d("ReportScore: score=" + score + ", board=" + board);
         string leaderboardId = MapId(board);
         mClient.SubmitScore(leaderboardId, score, callback);
     }
 }
コード例 #2
0
        /// <summary>
        /// Reports a score to a leaderboard.
        /// </summary>
        /// <param name='score'>
        /// The score to report.
        /// </param>
        /// <param name='board'>
        /// The ID of the leaderboard on which the score is to be posted. This may be a raw
        /// Google Play Games leaderboard ID or an alias configured through a call to
        /// <see cref="AddIdMapping" />.
        /// </param>
        /// <param name='callback'>
        /// The callback to call to report the success or failure of the operation. The callback
        /// will be called with <c>true</c> to indicate success or <c>false</c> for failure.
        /// </param>
        public void ReportScore(long score, string board, Action<bool> callback)
        {
            if (!IsAuthenticated())
            {
                Logger.e("ReportScore can only be called after authentication.");
                if (callback != null)
                {
                    callback.Invoke(false);
                }

                return;
            }

            Logger.d("ReportScore: score=" + score + ", board=" + board);
            string lbId = MapId(board);
            mClient.SubmitScore(lbId, score, callback);
        }