public void GetDescriptionImage(EditorAchievementDescription _description)
        {
            EGCAchievementDescription _curDescription = GetAchievementDescription(_description.Identifier);
            IDictionary _dataDict = new Dictionary <string, object>();

            if (_curDescription == null)
            {
                _dataDict[kErrorKey] = Constants.kGameServicesIdentifierInfoNotFoundError;
            }
            else if (_curDescription.Image == null)
            {
                _dataDict[kErrorKey] = "Image not found.";
            }
            else
            {
                _dataDict[kImageKey] = _curDescription.Image;
            }

            // Send event
            if (NPBinding.GameServices != null)
            {
                NPBinding.GameServices.InvokeMethod(kRequestForAchievementImageFinishedEvent, new object[] {
                    _description.GetInstanceID(),
                    _dataDict
                }, new Type[] {
                    typeof(string),
                    typeof(IDictionary)
                });
            }
        }
        private void ShowAchievementBanner(EGCAchievementDescription _description)
        {
            if (m_gameCenterUI == null)
            {
                CreateGameCenterUIInstance();
            }

            m_gameCenterUI.ShowAchievementBanner(_description);
        }
Exemplo n.º 3
0
        internal void ShowAchievementBanner(EGCAchievementDescription _description)
        {
            // Enable this script and set properties
            this.enabled = true;
            m_isShowingAchievementBanner = true;
            m_bannerText = _description.Title + " is completed.";

            // Start coroutine
            StartCoroutine(AnimateWindowRect());
        }
        public void ReportProgress(EditorAchievement _reportedAchievement)
        {
            string _instanceID = _reportedAchievement.GetInstanceID();

            if (!VerifyUser())
            {
                OnReportProgressFinished(_instanceID, null, Constants.kGameServicesUserAuthMissingError);
                return;
            }

            EGCAchievementDescription _reportedAchievementDescription = GetAchievementDescription(_reportedAchievement.Identifier);

            if (_reportedAchievementDescription == null)
            {
                OnReportProgressFinished(_instanceID, null, Constants.kGameServicesIdentifierInfoNotFoundError);
                return;
            }

            int            _pointsScored          = _reportedAchievement.PointsScored;
            int            _maxPoints             = _reportedAchievementDescription.MaximumPoints;
            bool           _isAchivementCompleted = _pointsScored >= _maxPoints;
            string         _achievementID         = _reportedAchievement.Identifier;
            EGCAchievement _gcAchievement         = GetAchievementWithID(_achievementID);

            if (_gcAchievement != null)
            {
                // Update values
                _gcAchievement.UpdateProgress(_pointsScored, _maxPoints, _isAchivementCompleted);

                // Invoke handler
                OnReportProgressFinished(_instanceID, _gcAchievement, null);
                return;
            }

            // Mostly its reported for first time
            EGCAchievementDescription _gcDescription = GetAchievementDescription(_achievementID);

            if (_gcDescription != null)
            {
                // Update properties of this description
                _gcDescription.IsHidden = false;

                // Create new achievement entry
                EGCAchievement _newAchievement = new EGCAchievement(_achievementID, _reportedAchievement.PointsScored, _maxPoints, _isAchivementCompleted);

                // Add it to the list
                m_achievementsList.Add(_newAchievement);

                // Action on finishing report
                OnReportProgressFinished(_instanceID, _newAchievement, null);
                return;
            }
        }
        public EditorAchievementDescription(EGCAchievementDescription _gcDescriptionInfo)
        {
            // Set properties from info object
            Identifier            = _gcDescriptionInfo.Identifier;
            Title                 = _gcDescriptionInfo.Title;
            UnachievedDescription = _gcDescriptionInfo.UnachievedDescription;
            AchievedDescription   = _gcDescriptionInfo.AchievedDescription;
            MaximumPoints         = _gcDescriptionInfo.MaximumPoints;
            IsHidden              = _gcDescriptionInfo.IsHidden;

            // Set global identifier
            GlobalIdentifier = GameServicesIDHandler.GetAchievementGID(Identifier);
        }
		public EditorAchievementDescription (EGCAchievementDescription _gcDescriptionInfo)
		{
			// Set properties from info object
			Identifier				= _gcDescriptionInfo.Identifier;
			Title					= _gcDescriptionInfo.Title;
			UnachievedDescription	= _gcDescriptionInfo.UnachievedDescription;
			AchievedDescription		= _gcDescriptionInfo.AchievedDescription;
			MaximumPoints			= _gcDescriptionInfo.MaximumPoints;
			IsHidden				= _gcDescriptionInfo.IsHidden; 

			// Set global identifier			
			GlobalIdentifier		= GameServicesIDHandler.GetAchievementGID(Identifier);
		}
Exemplo n.º 7
0
        public void LoadAchievementDescriptions(Action <EditorAchievementDescription[]> _onCompletion)
        {
            // Verify authentication state
            if (!VerifyUser())
            {
                _onCompletion(null);
                return;
            }

            // Send achievement description list using completion handler
            if (_onCompletion != null)
            {
                _onCompletion(EGCAchievementDescription.ConvertToEditorAchievementDescriptionList(m_achievementDescriptionList.ToArray()));
            }
        }
        public EditorAchievementDescription(EGCAchievementDescription _gcDescriptionInfo)
        {
            // Set properties from info object
            Identifier            = _gcDescriptionInfo.Identifier;
            Title                 = _gcDescriptionInfo.Title;
            UnachievedDescription = _gcDescriptionInfo.UnachievedDescription;
            AchievedDescription   = _gcDescriptionInfo.AchievedDescription;
#pragma warning disable
            MaximumPoints = _gcDescriptionInfo.MaximumPoints;
#pragma warning restore
            IsHidden = _gcDescriptionInfo.IsHidden;

            // Set global identifier
            GlobalIdentifier = GameServicesUtils.GetAchievementGID(Identifier);
        }
		internal void ShowAchievementBanner (EGCAchievementDescription _description)
		{
			// Enable this script and set properties
			this.enabled					= true;
			m_isShowingAchievementBanner	= true;
			m_bannerText					= _description.Title + " is completed.";

			// Start coroutine
			StartCoroutine(AnimateWindowRect());
		}
Exemplo n.º 10
0
        public void Refresh()
        {
            IDContainer[]                    _leaderboardIDCollection       = NPSettings.GameServicesSettings.LeaderboardIDCollection;
            IDContainer[]                    _achievementIDCollection       = NPSettings.GameServicesSettings.AchievementIDCollection;
            List <EGCLeaderboard>            _newLeaderboardList            = new List <EGCLeaderboard>();
            List <EGCAchievementDescription> _newAchievementDescriptionList = new List <EGCAchievementDescription>();
            List <EGCAchievement>            _newAchievementList            = new List <EGCAchievement>();

            // Update leaderboard info
            foreach (IDContainer _entry in _leaderboardIDCollection)
            {
                string _curLeaderboardID  = _entry.GetCurrentPlatformID();
                string _curLeaderboardGID = _entry.GetGlobalID();

                // Ignore null/empty identifiers
                if (string.IsNullOrEmpty(_curLeaderboardID))
                {
                    continue;
                }

                EGCLeaderboard _curLeaderboard = GetLeaderboardWithID(_curLeaderboardID);

                if (_curLeaderboard == null)
                {
                    _curLeaderboard = new EGCLeaderboard(_identifier: _curLeaderboardID, _title: _curLeaderboardGID);
                }

                // Add this entry to the new list
                _newLeaderboardList.Add(_curLeaderboard);
            }

            // Update descriptions and achievements info
            foreach (IDContainer _entry in _achievementIDCollection)
            {
                string _curAchievementID  = _entry.GetCurrentPlatformID();
                string _curAchievementGID = _entry.GetGlobalID();

                // Ignore null/empty identifiers
                if (string.IsNullOrEmpty(_curAchievementID))
                {
                    continue;
                }

                EGCAchievementDescription _curDescription = GetAchievementDescription(_curAchievementID);
                EGCAchievement            _curAchievement = GetAchievementWithID(_curAchievementID);

                if (_curDescription == null)
                {
                    _curDescription = new EGCAchievementDescription(_identifier: _curAchievementID,
                                                                    _title: _curAchievementGID,
                                                                    _achievedDescription: "Achieved description",
                                                                    _unachievedDescription: "Unachieved description",
                                                                    _maxPoints: 1,
                                                                    _image: null,
                                                                    _isHidden: false);
                }

                // Add entries to the new list
                _newAchievementDescriptionList.Add(_curDescription);

                if (_curAchievement != null)
                {
                    _newAchievementList.Add(_curAchievement);
                }
            }

            // Set these new values
            m_leaderboardList            = _newLeaderboardList;
            m_achievementsList           = _newAchievementList;
            m_achievementDescriptionList = _newAchievementDescriptionList;
        }