mirror of
https://github.com/osukey/osukey.git
synced 2025-08-04 23:24:04 +09:00
Fix multiplayer aggregate score inheriting from ScoreInfo
This commit is contained in:
@ -13,9 +13,9 @@ using osu.Game.Online.Multiplayer;
|
||||
|
||||
namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class MatchLeaderboard : Leaderboard<MatchLeaderboardScope, APIRoomScoreInfo>
|
||||
public class MatchLeaderboard : Leaderboard<MatchLeaderboardScope, APIUserScoreAggregate>
|
||||
{
|
||||
public Action<IEnumerable<APIRoomScoreInfo>> ScoresLoaded;
|
||||
public Action<IEnumerable<APIUserScoreAggregate>> ScoresLoaded;
|
||||
|
||||
[Resolved(typeof(Room), nameof(Room.RoomID))]
|
||||
private Bindable<int?> roomId { get; set; }
|
||||
@ -35,7 +35,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
|
||||
protected override bool IsOnlineScope => true;
|
||||
|
||||
protected override APIRequest FetchScores(Action<IEnumerable<APIRoomScoreInfo>> scoresCallback)
|
||||
protected override APIRequest FetchScores(Action<IEnumerable<APIUserScoreAggregate>> scoresCallback)
|
||||
{
|
||||
if (roomId.Value == null)
|
||||
return null;
|
||||
@ -51,7 +51,7 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
return req;
|
||||
}
|
||||
|
||||
protected override LeaderboardScore CreateDrawableScore(APIRoomScoreInfo model, int index) => new MatchLeaderboardScore(model, index);
|
||||
protected override LeaderboardScore CreateDrawableScore(APIUserScoreAggregate model, int index) => new MatchLeaderboardScore(model, index);
|
||||
}
|
||||
|
||||
public enum MatchLeaderboardScope
|
||||
|
@ -12,9 +12,12 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
{
|
||||
public class MatchLeaderboardScore : LeaderboardScore
|
||||
{
|
||||
public MatchLeaderboardScore(APIRoomScoreInfo score, int rank)
|
||||
: base(score, rank)
|
||||
private readonly APIUserScoreAggregate score;
|
||||
|
||||
public MatchLeaderboardScore(APIUserScoreAggregate score, int rank)
|
||||
: base(score.CreateScoreInfo(), rank)
|
||||
{
|
||||
this.score = score;
|
||||
}
|
||||
|
||||
[BackgroundDependencyLoader]
|
||||
@ -26,8 +29,8 @@ namespace osu.Game.Screens.Multi.Match.Components
|
||||
protected override IEnumerable<LeaderboardScoreStatistic> GetStatistics(ScoreInfo model) => new[]
|
||||
{
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Crosshairs, "Accuracy", string.Format(model.Accuracy % 1 == 0 ? @"{0:P0}" : @"{0:P2}", model.Accuracy)),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", ((APIRoomScoreInfo)model).TotalAttempts.ToString()),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", ((APIRoomScoreInfo)model).CompletedBeatmaps.ToString()),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Sync, "Total Attempts", score.TotalAttempts.ToString()),
|
||||
new LeaderboardScoreStatistic(FontAwesome.Solid.Check, "Completed Beatmaps", score.CompletedBeatmaps.ToString()),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user