Esempio n. 1
0
        public void ReportProgressWithID(string _achievementID, int _pointsScored, Achievement.ReportProgressCompletion _onCompletion)
        {
            string _achievementGID = GameServicesUtils.GetAchievementGID(_achievementID);

            // Invoke handler
            ReportProgress(_achievementGID, _achievementID, _pointsScored, _onCompletion);
        }
        public override void ReportProgress(Achievement.ReportProgressCompletion _onCompletion)
        {
            base.ReportProgress(_onCompletion);

            if (Description == null)
            {
                return;
            }

            GameServicesAndroid.Plugin.Call(GameServicesAndroid.Native.Methods.REPORT_PROGRESS, GetInstanceID(), Identifier, PointsScored, _onCompletion != null);
        }
Esempio n. 3
0
        public override void ReportProgress(Achievement.ReportProgressCompletion _onCompletion)
        {
            base.ReportProgress(_onCompletion);

            int _noOfStepsFromDescription = GetMaximumPointsFromAchievementDescription();

            if (MaximumPoints != _noOfStepsFromDescription)
            {
                Debug.LogError("[GameServices] Please make sure number of steps set in NPSettings and Maximum points for incremental achivement configured in Game Play services are same.");
            }

            GameServicesAndroid.Plugin.Call(GameServicesAndroid.Native.Methods.REPORT_PROGRESS, GetInstanceID(), Identifier, m_pointsScored, _onCompletion != null);
        }
Esempio n. 4
0
        private void ReportProgress(string _achievementGID, string _achievementID, int _pointsScored, Achievement.ReportProgressCompletion _onCompletion)
        {
            // Retrieve associated description
            AchievementDescription _description = AchievementHandler.GetAchievementDescriptionWithGlobalID(_achievementGID);

            if (_description == null)
            {
                DebugUtility.Logger.LogError(Constants.kDebugTag, "[GameServices] Failed to report progress.");

                if (_onCompletion != null)
                {
                    _onCompletion(false, "The requested operation could not be completed because Game Services couldn't find description for given Achievement identifier.");
                }

                return;
            }

            // Create achivement object
            Achievement _newAchievement = CreateAchievement(_achievementGID, _achievementID);

            if (_newAchievement == null)
            {
                DebugUtility.Logger.LogError(Constants.kDebugTag, "[GameServices] Failed to report progress.");

                if (_onCompletion != null)
                {
                    _onCompletion(false, "The requested operation could not be completed because Game Service failed to create Achievement object.");
                }

                return;
            }

            // Set the new progress value
#pragma warning disable
            _newAchievement.PercentageCompleted = ((double)_pointsScored / _description.MaximumPoints) * 100;
#pragma warning restore

            // Report it
            _newAchievement.ReportProgress(_onCompletion);
        }
Esempio n. 5
0
 public void ReportProgress(string _achievementID, int _pointsScored, Achievement.ReportProgressCompletion _onCompletion)
 {
     ReportProgressWithID(_achievementID, _pointsScored, _onCompletion);
 }
Esempio n. 6
0
        private void ReportProgress(string _achievementGID, string _achievementID, double _percentageCompleted, Achievement.ReportProgressCompletion _onCompletion)
        {
            Achievement _newAchievement = CreateAchievement(_achievementGID, _achievementID);

            if (_newAchievement == null)
            {
                DebugUtility.Logger.LogError(Constants.kDebugTag, "[GameServices] Failed to report progress.");

                if (_onCompletion != null)
                {
                    _onCompletion(false, "The requested operation could not be completed because Game Service failed to create Achievement object.");
                }

                return;
            }

            // Set the new progress value
            _newAchievement.PercentageCompleted = _percentageCompleted;

            // Report it
            _newAchievement.ReportProgress(_onCompletion);
        }
Esempio n. 7
0
        /// <summary>
        /// Reports the local user's achievement progress to game server, using unified id.
        /// </summary>
        /// <param name="_achievementGID">An unified string internally used to identify the achievement across all the supported platforms.</param>
        /// <param name="_percentageCompleted">The value indicates how far the player has progressed.</param>
        /// <param name="_onCompletion">Callback that will be called after operation is completed.</param>
        /// <remarks>
        /// \note Works only if, achievement metadata was configured in NPSettings or else explicitely set using <see cref="SetAchievementMetadataCollection"/>.
        /// </remarks>
        public void ReportProgressWithGlobalID(string _achievementGID, double _percentageCompleted, Achievement.ReportProgressCompletion _onCompletion)
        {
            string _achievementID = GameServicesUtils.GetAchievementID(_achievementGID);

            // Invoke handler
            ReportProgress(_achievementGID, _achievementID, _percentageCompleted, _onCompletion);
        }
        private void ReportProgress(string _achievementGID, string _achievementID, int _pointsScored, Achievement.ReportProgressCompletion _onCompletion)
        {
            Achievement _newAchievement = CreateAchievement(_achievementGID, _achievementID);

            if (_newAchievement == null)
            {
                DebugPRO.Console.LogError(Constants.kDebugTag, "[GameServices] Failed to report progress.");

                if (_onCompletion != null)
                {
                    _onCompletion(false, "The requested operation could not be completed because Game Service failed to create Achievement object.");
                }

                return;
            }

            // Set the points scored
            _newAchievement.PointsScored = _pointsScored;

            // Report
            _newAchievement.ReportProgress(_onCompletion);
        }