1
0
mirror of https://github.com/ppy/osu.git synced 2025-03-06 09:07:22 +08:00
osu-lazer/osu.Game/Overlays/Profile/Sections/ProfileSubsection.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

50 lines
1.7 KiB
C#
Raw Normal View History

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