diff --git a/osu.Game/Overlays/Profile/Sections/PaginatedContainerWithHeader.cs b/osu.Game/Overlays/Profile/Sections/PaginatedContainerWithHeader.cs index 9d8ed89053..32c589e342 100644 --- a/osu.Game/Overlays/Profile/Sections/PaginatedContainerWithHeader.cs +++ b/osu.Game/Overlays/Profile/Sections/PaginatedContainerWithHeader.cs @@ -1,7 +1,6 @@ // Copyright (c) ppy Pty Ltd . Licensed under the MIT Licence. // See the LICENCE file in the repository root for full licence text. -using System.Collections.Generic; using osu.Framework.Bindables; using osu.Framework.Graphics; using osu.Game.Users; @@ -13,7 +12,7 @@ namespace osu.Game.Overlays.Profile.Sections private readonly string headerText; private readonly CounterVisibilityState counterVisibilityState; - private PaginatedContainerHeader header; + protected PaginatedContainerHeader Header; protected PaginatedContainerWithHeader(Bindable user, string headerText, CounterVisibilityState counterVisibilityState, string missing = "") : base(user, missing) @@ -22,23 +21,12 @@ namespace osu.Game.Overlays.Profile.Sections this.counterVisibilityState = counterVisibilityState; } - protected override Drawable CreateHeaderContent => header = new PaginatedContainerHeader(headerText, counterVisibilityState); + protected override Drawable CreateHeaderContent => Header = new PaginatedContainerHeader(headerText, counterVisibilityState); protected override void OnUserChanged(User user) { base.OnUserChanged(user); - header.Current.Value = GetCount(user); - } - - protected override void OnItemsReceived(List items) - { - base.OnItemsReceived(items); - - if (counterVisibilityState == CounterVisibilityState.VisibleWhenZero) - { - header.Current.Value = items.Count; - header.Current.TriggerChange(); - } + Header.Current.Value = GetCount(user); } protected virtual int GetCount(User user) => 0; diff --git a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs index f1cf3e632c..0b2bddabbc 100644 --- a/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs +++ b/osu.Game/Overlays/Profile/Sections/Ranks/PaginatedScoreContainer.cs @@ -44,6 +44,19 @@ namespace osu.Game.Overlays.Profile.Sections.Ranks } } + protected override void OnItemsReceived(List items) + { + base.OnItemsReceived(items); + + if (type == ScoreType.Recent) + { + var count = items.Count; + + Header.Current.Value = count == 0 ? 0 : -1; + Header.Current.TriggerChange(); + } + } + protected override APIRequest> CreateRequest() => new GetUserScoresRequest(User.Value.Id, type, VisiblePages++, ItemsPerPage);