private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore)
        {
            var multiplayerUserScore = new MultiplayerScore
            {
                ID           = highestScoreId,
                Accuracy     = userScore.Accuracy,
                Passed       = userScore.Passed,
                Rank         = userScore.Rank,
                Position     = real_user_position,
                MaxCombo     = userScore.MaxCombo,
                User         = userScore.User,
                ScoresAround = new MultiplayerScoresAround
                {
                    Higher = new MultiplayerScores(),
                    Lower  = new MultiplayerScores()
                }
            };

            totalCount++;

            for (int i = 1; i <= scores_per_result; i++)
            {
                multiplayerUserScore.ScoresAround.Lower.Scores.Add(new MultiplayerScore
                {
                    ID       = getNextLowestScoreId(),
                    Accuracy = userScore.Accuracy,
                    Passed   = true,
                    Rank     = userScore.Rank,
                    MaxCombo = userScore.MaxCombo,
                    User     = new APIUser
                    {
                        Id       = 2,
                        Username = $"peppy{i}",
                        CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
                    },
                });

                multiplayerUserScore.ScoresAround.Higher.Scores.Add(new MultiplayerScore
                {
                    ID       = getNextHighestScoreId(),
                    Accuracy = userScore.Accuracy,
                    Passed   = true,
                    Rank     = userScore.Rank,
                    MaxCombo = userScore.MaxCombo,
                    User     = new APIUser
                    {
                        Id       = 2,
                        Username = $"peppy{i}",
                        CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
                    },
                });

                totalCount += 2;
            }

            addCursor(multiplayerUserScore.ScoresAround.Lower);
            addCursor(multiplayerUserScore.ScoresAround.Higher);

            return(multiplayerUserScore);
        }
Esempio n. 2
0
        private MultiplayerScore createUserResponse([NotNull] ScoreInfo userScore)
        {
            var multiplayerUserScore = new MultiplayerScore
            {
                ID           = (int)(userScore.OnlineScoreID ?? currentScoreId++),
                Accuracy     = userScore.Accuracy,
                EndedAt      = userScore.Date,
                Passed       = userScore.Passed,
                Rank         = userScore.Rank,
                Position     = 200,
                MaxCombo     = userScore.MaxCombo,
                TotalScore   = userScore.TotalScore,
                User         = userScore.User,
                Statistics   = userScore.Statistics,
                ScoresAround = new MultiplayerScoresAround
                {
                    Higher = new MultiplayerScores(),
                    Lower  = new MultiplayerScores()
                }
            };

            for (int i = 1; i <= scores_per_result; i++)
            {
                multiplayerUserScore.ScoresAround.Lower.Scores.Add(new MultiplayerScore
                {
                    ID         = currentScoreId++,
                    Accuracy   = userScore.Accuracy,
                    EndedAt    = userScore.Date,
                    Passed     = true,
                    Rank       = userScore.Rank,
                    MaxCombo   = userScore.MaxCombo,
                    TotalScore = userScore.TotalScore - i,
                    User       = new User
                    {
                        Id       = 2,
                        Username = $"peppy{i}",
                        CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
                    },
                    Statistics = userScore.Statistics
                });

                multiplayerUserScore.ScoresAround.Higher.Scores.Add(new MultiplayerScore
                {
                    ID         = currentScoreId++,
                    Accuracy   = userScore.Accuracy,
                    EndedAt    = userScore.Date,
                    Passed     = true,
                    Rank       = userScore.Rank,
                    MaxCombo   = userScore.MaxCombo,
                    TotalScore = userScore.TotalScore + i,
                    User       = new User
                    {
                        Id       = 2,
                        Username = $"peppy{i}",
                        CoverUrl = "https://osu.ppy.sh/images/headers/profile-covers/c3.jpg",
                    },
                    Statistics = userScore.Statistics
                });
            }

            addCursor(multiplayerUserScore.ScoresAround.Lower);
            addCursor(multiplayerUserScore.ScoresAround.Higher);

            return(multiplayerUserScore);
        }