private void OnScoresLoaded(ScoreloopResponse<LeaderboardScoresResponse> response)
        {
            if (!response.Success)
            {
                // todo: "error message" tms
                return;
            }

            foreach (Score score in response.Data.Scores)
            {
                _scores.Add(score);
            }
        }
        private void OnScoresLoaded(ScoreloopResponse<LeaderboardScoresResponse> response)
        {
            if (!response.Success)
            {
                if (response.Error == null || response.Error.Status != StatusCode.RequestCancelled)
                {
                    _hasFailed = true;
                    _failMessage = "Something went wrong. Please try again later";
                }

                return;
            }

            _scroller.ScrollingRange = new Range(0, FlaiMath.Max(0, _leaderboard.Scores.Count * ScoreSlotHeight - this.Game.ScreenSize.Height * 0.5f + 96));
            if (_leaderboard.CanLoadMoreScores && response.Data != null && response.Data.Scores.Count != 0)
            {
                float verticalPosition = OffsetFromTop + _leaderboard.Scores.Count * ScoreSlotHeight + 58;
                _loadMoreScoresButton.SetVerticalPosition(verticalPosition);
                _gotoTopButton.SetVerticalPosition(verticalPosition + 16);

                _loadMoreScoresButton.Enabled = true;
                _loadMoreScoresButton.Visible = true;

                _gotoTopButton.Enabled = true;
                _gotoTopButton.Visible = true;
            }
        }
示例#3
0
 private void OnUserRenamed(ScoreloopResponse response)
 {
     if (response.Success)
     {
         this.SetRenameSuccessText("Username updated!");
     }
     else
     {
         this.SetRenameErrorText(response.Error.ErrorCode == ErrorCode.UserInvalidArguments ? "Username is already taken" : "Something went wrong. Try again later");
     }
 }
        private void OnRankLoaded(ScoreloopResponse<RankResponse> response)
        {
            if (!response.Success)
            {
                if (response.Error == null || response.Error.Status != StatusCode.RequestCancelled)
                {
                    _hasFailed = true;
                    _failMessage = "Something went wrong. Please try again later";
                }

                return;
            }

            int rank = response.Data.Rank;
            int score = (rank == 0) ? 0 : (int)response.Data.Score.Result;
            _ranks.Add(response.Data.Scope, new ScoreRank(rank, score));

            if (_playerUserName == "" && rank != 0)
            {
                _playerUserName = response.Data.Score.User.Login;
            }
        }