private static void ReportError(string errorMessage, Action <CloudRequestResult <bool> > callbackAction)
        {
#if CO_DEBUG
            Debug.LogWarning(errorMessage);
#endif
            CloudOnceUtils.SafeInvoke(callbackAction, new CloudRequestResult <bool>(false, errorMessage));
        }
        private static void ReportSubmitScoreSuccess(long score, Action <CloudRequestResult <bool> > callbackAction, string id, string internalID)
        {
#if CO_DEBUG
            Debug.Log(string.Format("Successfully submitted a score of {0} to {1} ({2}) leaderboard.", score, internalID, id));
#endif
            CloudOnceUtils.SafeInvoke(callbackAction, new CloudRequestResult <bool>(true));
        }
        private static void OnReportCompleted(bool response, Action<CloudRequestResult<bool>> callbackAction, string action, string id, string internalID)
        {
            if (response)
            {
#if CO_DEBUG
                Debug.Log(string.Format("Achievement {0} ({1}) was successfully {2}ed.", internalID, id, action));
#endif
                CloudOnceUtils.SafeInvoke(callbackAction, new CloudRequestResult<bool>(true));
            }
            else
            {
                // Customize error message to fit either new or old achievement system.
                var error = string.IsNullOrEmpty(internalID)
                        ? string.Format("Native API failed to {0} achievement {1}. Cause unknown.", action, id)
                        : string.Format("Native API failed to {0} achievement {1} ({2}). Cause unknown.", action, internalID, id);
                ReportError(error, callbackAction);
            }
        }
 /// <summary>
 /// Load a default set of scores from the given leaderboard.
 /// </summary>
 /// <param name="leaderboardID">Current platform's ID for the leaderboard.</param>
 /// <param name="callback">Callback with scores.</param>
 public void LoadScores(string leaderboardID, Action <IScore[]> callback)
 {
     Debug.LogWarning("Leaderboards overlay is not supported in the Unity Editor.");
     CloudOnceUtils.SafeInvoke(callback, new IScore[0]);
 }
 private static void IncrementAchievementCallback(bool success)
 {
     CloudOnceUtils.SafeInvoke(s_onAppleIncrementCompleted, success);
 }
 /// <summary>
 /// Send notification about progress on this achievement.
 /// </summary>
 /// <param name="callback">Callback indicating whether report is successful or not.</param>
 public void ReportProgress(Action <bool> callback)
 {
     CloudOnceUtils.SafeInvoke(callback, true);
 }
 /// <summary>
 /// Load the achievements the logged in user has already achieved or reported progress on.
 /// </summary>
 /// <param name="callback">Callback to handle the achievements.</param>
 public void LoadAchievements(Action <IAchievement[]> callback)
 {
     CloudOnceUtils.SafeInvoke(callback, GetTestAchievements());
 }