1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-11 16:27:26 +08:00

Fix recent plays counter is always zero

This commit is contained in:
Andrei Zavatski 2020-09-07 23:33:04 +03:00
parent e39609d3ca
commit c72a192cb5
2 changed files with 18 additions and 0 deletions

View File

@ -107,6 +107,8 @@ namespace osu.Game.Overlays.Profile.Sections
protected virtual void UpdateItems(List<TModel> items) => Schedule(() => protected virtual void UpdateItems(List<TModel> items) => Schedule(() =>
{ {
OnItemsReceived(items);
if (!items.Any() && VisiblePages == 1) if (!items.Any() && VisiblePages == 1)
{ {
moreButton.Hide(); moreButton.Hide();
@ -133,6 +135,10 @@ namespace osu.Game.Overlays.Profile.Sections
showMore(); showMore();
} }
protected virtual void OnItemsReceived(List<TModel> items)
{
}
protected virtual Drawable CreateHeaderContent => Empty(); protected virtual Drawable CreateHeaderContent => Empty();
protected abstract APIRequest<List<TModel>> CreateRequest(); protected abstract APIRequest<List<TModel>> CreateRequest();

View File

@ -1,6 +1,7 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence. // Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text. // See the LICENCE file in the repository root for full licence text.
using System.Collections.Generic;
using osu.Framework.Bindables; using osu.Framework.Bindables;
using osu.Framework.Graphics; using osu.Framework.Graphics;
using osu.Game.Users; using osu.Game.Users;
@ -29,6 +30,17 @@ namespace osu.Game.Overlays.Profile.Sections
header.Current.Value = GetCount(user); header.Current.Value = GetCount(user);
} }
protected override void OnItemsReceived(List<TModel> items)
{
base.OnItemsReceived(items);
if (counterVisibilityState == CounterVisibilityState.VisibleWhenZero)
{
header.Current.Value = items.Count;
header.Current.TriggerChange();
}
}
protected virtual int GetCount(User user) => 0; protected virtual int GetCount(User user) => 0;
} }
} }