protected void LoadAchievementDescriptionsFinished(AchievementDescription[] _descriptions, string _error)
        {
            AchievementHandler.SetAchievementDescriptionList(_descriptions);

            // Send callback
            if (LoadAchievementDescriptionsFinishedEvent != null)
            {
                LoadAchievementDescriptionsFinishedEvent(_descriptions, _error);
            }
        }
Exemplo n.º 2
0
        protected void OnLoadAchievementDescriptionsFinished(AchievementDescription[] _descriptionList)
        {
            // Notify Achievement Handler about new description list
            AchievementHandler.SetAchievementDescriptionList(_descriptionList);

            // Completion handler is called
            if (m_loadAchievementDescriptionCallback != null)
            {
                m_loadAchievementDescriptionCallback(_descriptionList);
            }
        }
Exemplo n.º 3
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);
        }