mirror of
https://github.com/ppy/osu.git
synced 2024-12-14 10:12:54 +08:00
Merge pull request #4542 from smoogipoo/convert-ranking-statistics
Fix incorrect statistics being shown in results Co-authored-by: Dean Herbert <pe@ppy.sh>
This commit is contained in:
commit
ad44116845
@ -9,7 +9,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.MathUtils;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Overlays.BeatmapSet.Scores;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Osu;
|
||||
@ -44,9 +43,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
}
|
||||
};
|
||||
|
||||
IEnumerable<APIScoreInfo> scores = new[]
|
||||
IEnumerable<ScoreInfo> scores = new[]
|
||||
{
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -69,7 +68,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 1234567890,
|
||||
Accuracy = 1,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -91,7 +90,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 1234789,
|
||||
Accuracy = 0.9997,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -112,7 +111,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 12345678,
|
||||
Accuracy = 0.9854,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -132,7 +131,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 1234567,
|
||||
Accuracy = 0.8765,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -157,9 +156,9 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
|
||||
}
|
||||
|
||||
IEnumerable<APIScoreInfo> anotherScores = new[]
|
||||
IEnumerable<ScoreInfo> anotherScores = new[]
|
||||
{
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -181,7 +180,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 1234789,
|
||||
Accuracy = 0.9997,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -204,7 +203,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 1234567890,
|
||||
Accuracy = 1,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -220,7 +219,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 123456,
|
||||
Accuracy = 0.6543,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -241,7 +240,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
TotalScore = 12345678,
|
||||
Accuracy = 0.9854,
|
||||
},
|
||||
new APIScoreInfo
|
||||
new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
@ -269,7 +268,7 @@ namespace osu.Game.Tests.Visual.SongSelect
|
||||
s.Statistics.Add(HitResult.Meh, RNG.Next(2000));
|
||||
}
|
||||
|
||||
var topScoreInfo = new APIScoreInfo
|
||||
var topScoreInfo = new ScoreInfo
|
||||
{
|
||||
User = new User
|
||||
{
|
||||
|
@ -10,7 +10,7 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetScoresRequest : APIRequest<APIScores>
|
||||
public class GetScoresRequest : APIRequest<APILegacyScores>
|
||||
{
|
||||
private readonly BeatmapInfo beatmap;
|
||||
private readonly BeatmapLeaderboardScope scope;
|
||||
@ -31,9 +31,9 @@ namespace osu.Game.Online.API.Requests
|
||||
Success += onSuccess;
|
||||
}
|
||||
|
||||
private void onSuccess(APIScores r)
|
||||
private void onSuccess(APILegacyScores r)
|
||||
{
|
||||
foreach (APIScoreInfo score in r.Scores)
|
||||
foreach (APILegacyScoreInfo score in r.Scores)
|
||||
score.Beatmap = beatmap;
|
||||
}
|
||||
|
||||
|
@ -6,7 +6,7 @@ using osu.Game.Online.API.Requests.Responses;
|
||||
|
||||
namespace osu.Game.Online.API.Requests
|
||||
{
|
||||
public class GetUserScoresRequest : APIRequest<List<APIScoreInfo>>
|
||||
public class GetUserScoresRequest : APIRequest<List<APILegacyScoreInfo>>
|
||||
{
|
||||
private readonly long userId;
|
||||
private readonly ScoreType type;
|
||||
|
@ -8,12 +8,12 @@ using Newtonsoft.Json;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Rulesets;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Scoring.Legacy;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIScoreInfo : ScoreInfo
|
||||
public class APILegacyScoreInfo : LegacyScoreInfo
|
||||
{
|
||||
[JsonProperty(@"score")]
|
||||
private int totalScore
|
||||
@ -74,29 +74,37 @@ namespace osu.Game.Online.API.Requests.Responses
|
||||
HitResult newKey;
|
||||
switch (kvp.Key)
|
||||
{
|
||||
case @"count_geki":
|
||||
CountGeki = kvp.Value;
|
||||
break;
|
||||
case @"count_300":
|
||||
newKey = HitResult.Great;
|
||||
Count300 = kvp.Value;
|
||||
break;
|
||||
case @"count_katu":
|
||||
CountKatu = kvp.Value;
|
||||
break;
|
||||
case @"count_100":
|
||||
newKey = HitResult.Good;
|
||||
Count100 = kvp.Value;
|
||||
break;
|
||||
case @"count_50":
|
||||
newKey = HitResult.Meh;
|
||||
Count50 = kvp.Value;
|
||||
break;
|
||||
case @"count_miss":
|
||||
newKey = HitResult.Miss;
|
||||
CountMiss = kvp.Value;
|
||||
break;
|
||||
default:
|
||||
continue;
|
||||
}
|
||||
|
||||
Statistics.Add(newKey, kvp.Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[JsonProperty(@"mode_int")]
|
||||
public int OnlineRulesetID { get; set; }
|
||||
public int OnlineRulesetID
|
||||
{
|
||||
get => RulesetID;
|
||||
set => RulesetID = value;
|
||||
}
|
||||
|
||||
[JsonProperty(@"mods")]
|
||||
private string[] modStrings { get; set; }
|
@ -6,9 +6,9 @@ using Newtonsoft.Json;
|
||||
|
||||
namespace osu.Game.Online.API.Requests.Responses
|
||||
{
|
||||
public class APIScores
|
||||
public class APILegacyScores
|
||||
{
|
||||
[JsonProperty(@"scores")]
|
||||
public IEnumerable<APIScoreInfo> Scores;
|
||||
public IEnumerable<APILegacyScoreInfo> Scores;
|
||||
}
|
||||
}
|
@ -9,12 +9,12 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Overlays.Profile.Sections.Ranks;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
using osu.Game.Rulesets.Scoring;
|
||||
using osu.Game.Rulesets.UI;
|
||||
using osu.Game.Scoring;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
@ -26,7 +26,7 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
|
||||
private readonly Box background;
|
||||
|
||||
public DrawableScore(int index, APIScoreInfo score)
|
||||
public DrawableScore(int index, ScoreInfo score)
|
||||
{
|
||||
ScoreModsContainer modsContainer;
|
||||
|
||||
|
@ -11,7 +11,6 @@ using osu.Framework.Graphics.Shapes;
|
||||
using osu.Framework.Input.Events;
|
||||
using osu.Game.Graphics;
|
||||
using osu.Game.Graphics.Sprites;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Online.Leaderboards;
|
||||
using osu.Game.Overlays.Profile.Sections.Ranks;
|
||||
using osu.Game.Rulesets.Mods;
|
||||
@ -43,9 +42,9 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
private readonly InfoColumn statistics;
|
||||
private readonly ScoreModsContainer modsContainer;
|
||||
|
||||
private APIScoreInfo score;
|
||||
private ScoreInfo score;
|
||||
|
||||
public APIScoreInfo Score
|
||||
public ScoreInfo Score
|
||||
{
|
||||
get => score;
|
||||
set
|
||||
|
@ -11,7 +11,7 @@ using System.Linq;
|
||||
using osu.Framework.Allocation;
|
||||
using osu.Game.Beatmaps;
|
||||
using osu.Game.Online.API;
|
||||
using osu.Game.Online.API.Requests.Responses;
|
||||
using osu.Game.Scoring;
|
||||
|
||||
namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
{
|
||||
@ -29,10 +29,10 @@ namespace osu.Game.Overlays.BeatmapSet.Scores
|
||||
set => loadingAnimation.FadeTo(value ? 1 : 0, fade_duration);
|
||||
}
|
||||
|
||||
private IEnumerable<APIScoreInfo> scores;
|
||||
private IEnumerable<ScoreInfo> scores;
|
||||
private BeatmapInfo beatmap;
|
||||
|
||||
public IEnumerable<APIScoreInfo> Scores
|
||||
public IEnumerable<ScoreInfo> Scores
|
||||
{
|
||||
get => scores;
|
||||
set
|
||||
|
Loading…
Reference in New Issue
Block a user