From b8b5c67cd2502bbe25a3b90f8f5b501d4274aa5c Mon Sep 17 00:00:00 2001 From: EVAST9919 Date: Mon, 6 Nov 2017 21:46:28 +0300 Subject: [PATCH] Apply suggestion concerning the BeatmapSetType enum --- .../API/Requests/GetUserBeatmapsRequest.cs | 22 ++++++++++++++----- osu.Game/Overlays/BeatmapSet/SuccessRate.cs | 2 +- .../Profile/Sections/BeatmapsSection.cs | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs index 8c243f899b..7ad3c32bed 100644 --- a/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs +++ b/osu.Game/Online/API/Requests/GetUserBeatmapsRequest.cs @@ -8,23 +8,35 @@ namespace osu.Game.Online.API.Requests public class GetUserBeatmapsRequest : APIRequest> { private readonly long userId; - private readonly BeatmapSetType type; private readonly int offset; + private readonly string type; public GetUserBeatmapsRequest(long userId, BeatmapSetType type, int offset = 0) { this.userId = userId; - this.type = type; this.offset = offset; + + switch (type) + { + case BeatmapSetType.Favourite: + this.type = type.ToString().ToLower(); + break; + case BeatmapSetType.MostPlayed: + this.type = "most_played"; + break; + case BeatmapSetType.RankedAndApproved: + this.type = "ranked_and_approved"; + break; + } } - protected override string Target => $@"users/{userId}/beatmapsets/{type.ToString().ToLower()}?offset={offset}"; + protected override string Target => $@"users/{userId}/beatmapsets/{type}?offset={offset}"; } public enum BeatmapSetType { - Most_Played, + MostPlayed, Favourite, - Ranked_And_Approved + RankedAndApproved } } diff --git a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs index e22ec3c70c..6df31b9f85 100644 --- a/osu.Game/Overlays/BeatmapSet/SuccessRate.cs +++ b/osu.Game/Overlays/BeatmapSet/SuccessRate.cs @@ -32,7 +32,7 @@ namespace osu.Game.Overlays.BeatmapSet int passCount = beatmap.OnlineInfo.PassCount; int playCount = beatmap.OnlineInfo.PlayCount; - var rate = (playCount != 0) ? (float)passCount / playCount : 0; + var rate = playCount != 0 ? (float)passCount / playCount : 0; successPercent.Text = rate.ToString("P0"); successRate.Length = rate; percentContainer.ResizeWidthTo(successRate.Length, 250, Easing.InOutCubic); diff --git a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs index 708487b8e2..f55de9b83f 100644 --- a/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs +++ b/osu.Game/Overlays/Profile/Sections/BeatmapsSection.cs @@ -17,7 +17,7 @@ namespace osu.Game.Overlays.Profile.Sections Children = new[] { new PaginatedBeatmapContainer(BeatmapSetType.Favourite, User, "Favourite Beatmaps", "None... yet."), - new PaginatedBeatmapContainer(BeatmapSetType.Ranked_And_Approved, User, "Ranked & Approved Beatmaps", "None... yet."), + new PaginatedBeatmapContainer(BeatmapSetType.RankedAndApproved, User, "Ranked & Approved Beatmaps", "None... yet."), }; } }