Example #1
0
        private void DoAction()
        {
#if USES_GAME_SERVICES
            try
            {
                // Find description object
                AchievementDescription _description = null;

                if (isGlobalIdentifier.Value)
                {
                    _description = AchievementHandler.GetAchievementDescriptionWithGlobalID(identifier.Value);
                }
                else
                {
                    _description = AchievementHandler.GetAchievementDescriptionWithID(identifier.Value);
                }

                // Update properties
                title.Value = _description.Title;
                achievedDescription.Value   = _description.AchievedDescription;
                unachievedDescription.Value = _description.UnachievedDescription;
                isHidden.Value = _description.IsHidden;

                // Check if image has to be download
                if (loadImage.Value)
                {
                    _description.GetImageAsync((Texture2D _image, string _error) => {
                        // Update the image property
                        image.Value = _image;

                        OnActionDidFinish();

                        return;
                    });
                }
                else
                {
                    // Update the image property
                    image.Value = null;

                    OnActionDidFinish();

                    return;
                }

                return;
            }
            catch (System.Exception _exception)
            {
                Debug.Log(_exception.Message);

                OnActionDidFail();

                return;
            }
#endif
        }