mirror of
https://github.com/ppy/osu
synced 2025-01-24 06:43:04 +00:00
Apply suggestion concerning the BeatmapSetType enum
This commit is contained in:
parent
ebaef86432
commit
b8b5c67cd2
@ -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
|
||||
}
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -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."),
|
||||
};
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user