protected override void LoadAchievementDescriptions (bool _needsVerification, AchievementDescription.LoadAchievementDescriptionsCompletion _onCompletion)
		{
			base.LoadAchievementDescriptions(_needsVerification, _onCompletion);
			
			// Verify auth status
			if (_needsVerification && !VerifyUser())
				return;
			
			EditorGameCenter.Instance.LoadAchievementDescriptions();
		}
		internal static void SetAchievementDescriptionList (AchievementDescription[] _descriptionList)
		{
			if (_descriptionList == null)
			{
				cachedAchievementDescriptionList	= null;
				cachedAchievementDescriptionCount	= 0;
			}
			else
			{
				cachedAchievementDescriptionList	= _descriptionList;
				cachedAchievementDescriptionCount	= _descriptionList.Length;
			}
		}
        protected void RequestForAchievementImageFinished(string _instanceID, IDictionary _dataDict)
        {
            AchievementDescription _description = NPObjectManager.GetObjectWithInstanceID <AchievementDescription>(_instanceID, NPObjectManager.eCollectionType.GAME_SERVICES);

            if (_description == null)
            {
                return;
            }

            // Invoke response handler
            _description.InvokeMethod(kDescriptionRequestForImageFinishedEvent, new object[] {
                _dataDict
            }, new Type[] {
                typeof(IDictionary)
            });
        }
Ejemplo 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);
        }
Ejemplo n.º 5
0
        public static AchievementDescription GetAchievementDescriptionWithGlobalID(string _achievementGID)
        {
            if (achievementDescriptionList == null)
            {
                DebugUtility.Logger.LogError(Constants.kDebugTag, "[GameServices] Please fetch achievement description list before accessing achievement properties.");
                return(null);
            }

            // Iterate through each description and find description which has matching identifier
            for (int _iter = 0; _iter < achievementDescriptionCount; _iter++)
            {
                AchievementDescription _curDescription = achievementDescriptionList[_iter];
                string _curDescriptionGID = _curDescription.GlobalIdentifier;

                if (_curDescriptionGID.Equals(_achievementGID))
                {
                    return(_curDescription);
                }
            }

            DebugUtility.Logger.LogError(Constants.kDebugTag, string.Format("[GameServices] Couldnt find achievement description with global identifier= {0}.", _achievementGID));
            return(null);
        }
Ejemplo n.º 6
0
        internal static AchievementDescription GetAchievementDescription(string _achievementID)
        {
            if (cachedAchievementDescriptionList == null)
            {
                Console.LogError(Constants.kDebugTag, "[GameServices] Please fetch achievement description list before accessing achievement properties.");
                return(null);
            }

            // Iterate through each description and find description which has matching identifier
            for (int _iter = 0; _iter < cachedAchievementDescriptionCount; _iter++)
            {
                AchievementDescription _curDescription = cachedAchievementDescriptionList[_iter];
                string _curDescriptionID = _curDescription.Identifier;

                if (_curDescriptionID.Equals(_achievementID))
                {
                    return(_curDescription);
                }
            }

            Console.LogError(Constants.kDebugTag, string.Format("[GameServices] Couldnt find achievement description with  identifier= {0}.", _achievementID));
            return(null);
        }
		protected override void LoadAchievementDescriptions (bool _needsVerification, AchievementDescription.LoadAchievementDescriptionsCompletion _onCompletion)
		{
			base.LoadAchievementDescriptions(_needsVerification, _onCompletion);
			
			// Verify user authentication state before proceeding
			if (_needsVerification && !VerifyUser())
			{				
				return;
			}
			
			Plugin.Call(Native.Methods.LOAD_ACHIEVEMENT_DESCRIPTIONS);
		}
		protected override void LoadAchievementDescriptions (bool _needsVerification, AchievementDescription.LoadAchievementDescriptionsCompletion _onCompletion)
		{
			base.LoadAchievementDescriptions(_needsVerification, _onCompletion);
			
			// Verify auth status
			if (_needsVerification && !VerifyUser())
				return;

			// Native method call
			loadAchievementDescriptions();
		}
		protected void LoadAchievementDescriptionsFinished (AchievementDescription[] _descriptions, string _error)
		{
			AchievementHandler.SetAchievementDescriptionList(_descriptions);
			
			// Send callback
			if (LoadAchievementDescriptionsFinishedEvent != null)
				LoadAchievementDescriptionsFinishedEvent(_descriptions, _error);
		}
		protected virtual void LoadAchievementDescriptions (bool _needsVerification, AchievementDescription.LoadAchievementDescriptionsCompletion _onCompletion)
		{
			// Cache callback
			LoadAchievementDescriptionsFinishedEvent = _onCompletion;

			// Verify user authentication state before proceeding
			if (_needsVerification && !VerifyUser())
			{
				LoadAchievementDescriptionsFinished(null, Constants.kGameServicesUserAuthMissingError);
				return;
			}
		}
		/// <summary>
		/// Loads the achievement descriptions from game service server.
		/// </summary>
		/// <param name="_onCompletion">Callback to be called when request completes.</param>
		public void LoadAchievementDescriptions (AchievementDescription.LoadAchievementDescriptionsCompletion _onCompletion)
		{
			LoadAchievementDescriptions(true, _onCompletion);
		}
		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);
		}