2020-11-21 08:18:24 +08:00
|
|
|
|
// 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.Allocation;
|
|
|
|
|
using osu.Framework.Bindables;
|
|
|
|
|
using osu.Framework.Graphics;
|
|
|
|
|
using osu.Framework.Graphics.Containers;
|
2021-07-17 21:45:17 +08:00
|
|
|
|
using osu.Framework.Localisation;
|
2020-11-21 08:18:24 +08:00
|
|
|
|
|
|
|
|
|
namespace osu.Game.Overlays.Profile.Sections
|
|
|
|
|
{
|
|
|
|
|
public abstract partial class ProfileSubsection : FillFlowContainer
|
|
|
|
|
{
|
2022-12-30 21:56:19 +08:00
|
|
|
|
protected readonly Bindable<UserProfile?> UserProfile = new Bindable<UserProfile?>();
|
2020-11-21 08:18:24 +08:00
|
|
|
|
|
2021-07-17 21:45:17 +08:00
|
|
|
|
private readonly LocalisableString headerText;
|
2020-11-21 08:18:24 +08:00
|
|
|
|
private readonly CounterVisibilityState counterVisibilityState;
|
|
|
|
|
|
2022-12-30 20:17:59 +08:00
|
|
|
|
private ProfileSubsectionHeader header = null!;
|
2020-11-21 08:18:24 +08:00
|
|
|
|
|
2022-12-30 21:56:19 +08:00
|
|
|
|
protected ProfileSubsection(Bindable<UserProfile?> userProfile, LocalisableString? headerText = null, CounterVisibilityState counterVisibilityState = CounterVisibilityState.AlwaysHidden)
|
2020-11-21 08:18:24 +08:00
|
|
|
|
{
|
2021-07-17 22:13:33 +08:00
|
|
|
|
this.headerText = headerText ?? string.Empty;
|
2020-11-21 08:18:24 +08:00
|
|
|
|
this.counterVisibilityState = counterVisibilityState;
|
2022-12-30 21:56:19 +08:00
|
|
|
|
UserProfile.BindTo(userProfile);
|
2020-11-21 08:18:24 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[BackgroundDependencyLoader]
|
2020-11-22 03:49:56 +08:00
|
|
|
|
private void load()
|
2020-11-21 08:18:24 +08:00
|
|
|
|
{
|
|
|
|
|
RelativeSizeAxes = Axes.X;
|
|
|
|
|
AutoSizeAxes = Axes.Y;
|
|
|
|
|
Direction = FillDirection.Vertical;
|
|
|
|
|
|
|
|
|
|
Children = new[]
|
|
|
|
|
{
|
|
|
|
|
header = new ProfileSubsectionHeader(headerText, counterVisibilityState)
|
|
|
|
|
{
|
2021-07-17 22:13:33 +08:00
|
|
|
|
Alpha = string.IsNullOrEmpty(headerText.ToString()) ? 0 : 1
|
2020-11-21 08:18:24 +08:00
|
|
|
|
},
|
2020-11-22 04:03:54 +08:00
|
|
|
|
CreateContent()
|
2020-11-21 08:18:24 +08:00
|
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
protected abstract Drawable CreateContent();
|
|
|
|
|
|
|
|
|
|
protected void SetCount(int value) => header.Current.Value = value;
|
|
|
|
|
}
|
|
|
|
|
}
|