mirror of
https://github.com/osukey/osukey.git
synced 2025-07-02 16:59:53 +09:00
Implement PaginatedContainerWithHeader component
This commit is contained in:
@ -0,0 +1,34 @@
|
||||
// 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.
|
||||
|
||||
using osu.Framework.Bindables;
|
||||
using osu.Framework.Graphics;
|
||||
using osu.Game.Users;
|
||||
|
||||
namespace osu.Game.Overlays.Profile.Sections
|
||||
{
|
||||
public abstract class PaginatedContainerWithHeader<TModel> : PaginatedContainer<TModel>
|
||||
{
|
||||
private readonly string headerText;
|
||||
private readonly CounterVisibilityState counterVisibilityState;
|
||||
|
||||
private PaginatedContainerHeader header;
|
||||
|
||||
public PaginatedContainerWithHeader(Bindable<User> user, string headerText, CounterVisibilityState counterVisibilityState, string missing = "")
|
||||
: base(user, missing)
|
||||
{
|
||||
this.headerText = headerText;
|
||||
this.counterVisibilityState = 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 virtual int GetCount(User user) => 0;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user