1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-22 05:27:23 +08:00

Merge pull request #12663 from Joehuu/fix-profile-subsection-counters

This commit is contained in:
Dean Herbert 2021-05-03 12:15:28 +09:00 committed by GitHub
commit d8d2c731ee
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 21 additions and 12 deletions

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections.Beatmaps
private readonly BeatmapSetType type;
public PaginatedBeatmapContainer(BeatmapSetType type, Bindable<User> user, string headerText)
: base(user, headerText, "", CounterVisibilityState.AlwaysVisible)
: base(user, headerText)
{
this.type = type;
ItemsPerPage = 6;

View File

@ -16,7 +16,7 @@ namespace osu.Game.Overlays.Profile.Sections.Historical
public class PaginatedMostPlayedBeatmapContainer : PaginatedProfileSubsection<APIUserMostPlayedBeatmap>
{
public PaginatedMostPlayedBeatmapContainer(Bindable<User> user)
: base(user, "Most Played Beatmaps", "No records. :(", CounterVisibilityState.AlwaysVisible)
: base(user, "Most Played Beatmaps")
{
ItemsPerPage = 5;
}

View File

@ -20,7 +20,7 @@ namespace osu.Game.Overlays.Profile.Sections
{
new PlayHistorySubsection(User),
new PaginatedMostPlayedBeatmapContainer(User),
new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)", CounterVisibilityState.VisibleWhenZero),
new PaginatedScoreContainer(ScoreType.Recent, User, "Recent Plays (24h)"),
new ReplaysSubsection(User)
};
}

View File

@ -38,8 +38,8 @@ namespace osu.Game.Overlays.Profile.Sections
private OsuSpriteText missing;
private readonly string missingText;
protected PaginatedProfileSubsection(Bindable<User> user, string headerText = "", string missingText = "", CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
: base(user, headerText, counterVisibilityState)
protected PaginatedProfileSubsection(Bindable<User> user, string headerText = "", string missingText = "")
: base(user, headerText, CounterVisibilityState.AlwaysVisible)
{
this.missingText = missingText;
}

View File

@ -18,8 +18,8 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
private readonly ScoreType type;
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string headerText, CounterVisibilityState counterVisibilityState, string missingText = "")
: base(user, headerText, missingText, counterVisibilityState)
public PaginatedScoreContainer(ScoreType type, Bindable<User> user, string headerText)
: base(user, headerText)
{
this.type = type;
@ -36,9 +36,15 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
{
switch (type)
{
case ScoreType.Best:
return user.ScoresBestCount;
case ScoreType.Firsts:
return user.ScoresFirstCount;
case ScoreType.Recent:
return user.ScoresRecentCount;
default:
return 0;
}
@ -50,9 +56,6 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks
drawableItemIndex = 0;
base.OnItemsReceived(items);
if (type == ScoreType.Recent)
SetCount(items.Count);
}
protected override APIRequest<List<APILegacyScoreInfo>> CreateRequest() =>

View File

@ -16,8 +16,8 @@ namespace osu.Game.Overlays.Profile.Sections
{
Children = new[]
{
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance", CounterVisibilityState.AlwaysHidden, "No performance records. :("),
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks", CounterVisibilityState.AlwaysVisible)
new PaginatedScoreContainer(ScoreType.Best, User, "Best Performance"),
new PaginatedScoreContainer(ScoreType.Firsts, User, "First Place Ranks")
};
}
}

View File

@ -144,9 +144,15 @@ namespace osu.Game.Users
[JsonProperty(@"unranked_beatmapset_count")]
public int UnrankedBeatmapsetCount;
[JsonProperty(@"scores_best_count")]
public int ScoresBestCount;
[JsonProperty(@"scores_first_count")]
public int ScoresFirstCount;
[JsonProperty(@"scores_recent_count")]
public int ScoresRecentCount;
[JsonProperty(@"beatmap_playcounts_count")]
public int BeatmapPlaycountsCount;