public override void OnEnter()
        {
#if USES_GAME_SERVICES
            try
            {
                Leaderboard _leaderboard = GameServicesUtils.GetLeaderboard(identifier.Value, isGlobalIdentifier.Value);
                Score       _score       = _leaderboard.LocalUserScore;

                if (_score == null)
                {
                    OnActionDidFail();

                    return;
                }
                else
                {
                    User _user = _score.User;

                    // Update properties
                    userIdentifier.Value = _user.Identifier;
                    userName.Value       = _user.Name;
                    value.Value          = (int)_score.Value;
                    date.Value           = _score.Date.ToString(dateTimeFormat.Value);
                    formattedValue.Value = _score.FormattedValue;
                    rank.Value           = _score.Rank;

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

                            OnActionDidFinish();

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

                        OnActionDidFinish();

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

                OnActionDidFail();

                return;
            }
#endif
        }
Пример #2
0
        private void DoAction()
        {
#if USES_GAME_SERVICES
            Leaderboard _leaderboard = GameServicesUtils.GetLeaderboard(identifier.Value, isGlobalIdentifier.Value);

            if (_leaderboard == null)
            {
                Log("[GameServices] Leaderboard is null.");
                title.Value = null;
            }
            else
            {
                title.Value = _leaderboard.Title;
            }
#endif
        }