Apply suggestion concerning the BeatmapSetType enum

This commit is contained in:
EVAST9919 2017-11-06 21:46:28 +03:00
parent ebaef86432
commit b8b5c67cd2
3 changed files with 19 additions and 7 deletions

View File

@ -8,23 +8,35 @@ namespace osu.Game.Online.API.Requests
public class GetUserBeatmapsRequest : APIRequest<List<GetBeatmapSetsResponse>>
{
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
}
}

View File

@ -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);

View File

@ -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."),
};
}
}